Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-2801

HIVE2: HAVING specified without GROUP BY

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.7
    • 8.6
    • Query Engine
    • Hide

      I create a simple UNION ALL query for HIVE1 and HIVE2.

      select sum("amount") as "sum_amount"
      from (select * from Hive1.opportunities_small UNION ALL select * from Hive2.opportunities_small) "query"

      And Teiid will generate 2 SQLs. One for HIVE1 and one for HIVE2.

      SELECT SUM(g_0.amount) FROM opportunities_small
      g_0 HAVING SUM(g_0.amount) IS NOT NULL

      And HIVE driver will return error when running the SQL generated by Teiid.

      HAVING specified without GROUP BY, errorCode:40000, SQLState:42000)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1494)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1480)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result.read(ThriftHive.java:1430)
      at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
      at org.apache.hadoop.hive.service.ThriftHive$Client.recv_execute(ThriftHive.java:116)
      at org.apache.hadoop.hive.service.ThriftHive$Client.execute(ThriftHive.java:103)
      at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeImmediate(HivePreparedStatement.java:175)

      Show
      I create a simple UNION ALL query for HIVE1 and HIVE2. select sum("amount") as "sum_amount" from (select * from Hive1.opportunities_small UNION ALL select * from Hive2.opportunities_small) "query" And Teiid will generate 2 SQLs. One for HIVE1 and one for HIVE2. SELECT SUM(g_0.amount) FROM opportunities_small g_0 HAVING SUM(g_0.amount) IS NOT NULL And HIVE driver will return error when running the SQL generated by Teiid. HAVING specified without GROUP BY, errorCode:40000, SQLState:42000) at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1494) at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1480) at org.apache.hadoop.hive.service.ThriftHive$execute_result.read(ThriftHive.java:1430) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.hadoop.hive.service.ThriftHive$Client.recv_execute(ThriftHive.java:116) at org.apache.hadoop.hive.service.ThriftHive$Client.execute(ThriftHive.java:103) at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeImmediate(HivePreparedStatement.java:175)

    Description

      If SQL contains HAVING, with group by.

      HIVE2 will throw the following exception:

      HAVING specified without GROUP BY, errorCode:40000, SQLState:42000)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1494)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1480)
      at org.apache.hadoop.hive.service.ThriftHive$execute_result.read(ThriftHive.java:1430)
      at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
      at org.apache.hadoop.hive.service.ThriftHive$Client.recv_execute(ThriftHive.java:116)
      at org.apache.hadoop.hive.service.ThriftHive$Client.execute(ThriftHive.java:103)
      at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeImmediate(HivePreparedStatement.java:175)

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            mchantibco Ivan Chan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: