[ 
https://issues.apache.org/jira/browse/IMPALA-14775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18060524#comment-18060524
 ] 

Steve Carlin commented on IMPALA-14775:
---------------------------------------

I think it may have to do with the following lines in Calcite?
[https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java#L845-L849]

The rollup creates an empty group so it hits the rewrite code.  If I comment 
out the code that calls the rewriteScalar, the query returns the correct 
results.

I'll try to create a minimum test case in Calcite.  Haven't done that before, 
but I'll work on that this week.

> Calcite Planner: Wrong results with decorrelation query
> -------------------------------------------------------
>
>                 Key: IMPALA-14775
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14775
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Steve Carlin
>            Priority: Major
>
> There seems to be an issue with some code in Calcite 1.42 causing different 
> results from the original planner.
> The following query found in 
> [query_test/test_aggregation.py::TestAggregationQueries::test_grouping_sets|https://jenkins.impala.io/view/all/job/calcite-report-prototype/420/artifact/Impala/calcite_report/html/query_test_test_aggregation.py/TestAggregationQueries_test_grouping_sets/index.html]
>  
> works fine in 1.41:
>  
> {code:java}
> select id
> from functional.alltypesagg a
> where exists
>   (select id
>    from functional.alltypestiny b
>    where a.tinyint_col = b.tinyint_col and a.string_col = b.string_col
>    group by rollup(id, int_col, bool_col))
>   and tinyint_col < 10;
> {code}
> It returns 10 rows in the original planner and with Calcite 1.41, but with 
> Calcite 1.42, it returns 9000 rows.
> [~zwhtx] , I see you've been working on Impala and Calcite, and I think you 
> made a bunch of changes in the RelDecorrelator.java file for 1.42?  I'm gonna 
> start to look at this, but if you could help out, that would be fantastic, 
> thanks!
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to