shampoo liu created CALCITE-5566:
------------------------------------

             Summary: agg can't be pushed down correctly
                 Key: CALCITE-5566
                 URL: https://issues.apache.org/jira/browse/CALCITE-5566
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.33.0
            Reporter: shampoo liu


{code:sql}
select count(*) from (select max("position_title") "position_title" from 
"foodmart"."employee" where "gender" like '%a%' group by "birth_date", 
"gender") where "position_title" like '%z%'
{code}
The plan generated from sql above is as this :
{code:java}
PLAN=EnumerableAggregate(group=[{}], EXPR$0=[COUNT()])
  JdbcToEnumerableConverter
    JdbcFilter(condition=[LIKE($2, '%z%')])
      JdbcAggregate(group=[{8, 15}], position_title=[MAX($5)])
        JdbcFilter(condition=[LIKE($15, '%a%')])
          JdbcTableScan(table=[[foodmart, employee]])
{code}

Expected:
{code:java}
PLAN=JdbcToEnumerableConverter
  JdbcAggregate(group=[{}], EXPR$0=[COUNT()])
    JdbcFilter(condition=[LIKE($2, '%z%')])
      JdbcAggregate(group=[{8, 15}], position_title=[MAX($5)])
        JdbcFilter(condition=[LIKE($15, '%a%')])
          JdbcTableScan(table=[[foodmart, employee]])
{code}






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

Reply via email to