kasakrisz opened a new pull request #2039:
URL: https://github.com/apache/hive/pull/2039


   ### What changes were proposed in this pull request?
   1. When transforming subquery AST to calcite plan check whether the subquery 
is a full aggregation: has aggregate functions without group by clause
   2. When building subquery expression return `true` literal if subquery is a 
full aggregation having `EXISTS` operator instead of `RexSubQuery`
   
   ### Why are the changes needed?
   To support queries like:
   ```
   SELECT t1.bigint_col
   FROM alltypestiny t1
   WHERE EXISTS
     (SELECT SUM(smallint_col) AS int_col
      FROM alltypestiny
      WHERE t1.date_string_col = string_col AND t1.timestamp_col = 
timestamp_col)
   GROUP BY t1.bigint_col
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Current Hive implementation throws exception when compiling queries 
like the example above. With this patch query compiles and runs.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest.output.overwrite -DskipSparkTests 
-Dtest=TestMiniLlapLocalCliDriver -Dqfile=subquery_full_aggregate.q -pl 
itests/qtest -Pitests
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to