Steve Carlin created IMPALA-15125:
-------------------------------------

             Summary: Calcite Planner: Filter/Values merge failing after 
upgrade to Calcite 1.42
                 Key: IMPALA-15125
                 URL: https://issues.apache.org/jira/browse/IMPALA-15125
             Project: IMPALA
          Issue Type: Sub-task
            Reporter: Steve Carlin


The following query is failing to simplify a Filters-Value reduction:

  select id, int_col,

      row_number() over (order by string_col desc) as rownum

  from functional.alltypesagg UNION ALL select 1, 2, 3) v 

where rownum <= 20 db: default

The following RelNodes are not being reduced:


    LogicalFilter(condition=[<=(CAST($2):BIGINT, 20)]), id = 58

      LogicalValues(tuples=[[\{ 1, 2, 3 }]]), id = 4

Digging into the code a little bit:
The filter condition in 1.41 contains the constant.  In 1.42, the filter 
expression initially contains the RexInputRef.  It does get reduced, but the 
reduction is to a RexCall, "CAST(true):boolean". That's as far as I got 
debugging, not sure why that isn't reducing.  Also, Calcite is not calling our 
reducer/simplifier, it is hardcoded into their rule.

Because it's a filter on top of a Values, this will have minimal performance 
impact, since Values RelNodes will never be big, but this still should be fixed.

 



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

Reply via email to