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

shampoo liu commented on CALCITE-5566:
--------------------------------------

[~libenchao] Yes, you're right. The graphviz file [^dump.dot] that I attached 
indicates  *rows* become 1 after _JdbcFilter(condition=[LIKE($2, '%z%')]) ._
Since the calculation of the JdbcToEnumerableConverter's self cost depends only 
on the number of rows, and the costs of JdbcAggregate and EnumerableAggregate 
are the same, the final cost of the plan is also the same.
I think RelNode like Enumerable should have an increase in cost.

> 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
>            Priority: Major
>         Attachments: dump.dot
>
>
> {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}
> test case: 
> https://github.com/shpodg/calcite/commit/7c7aa35ca9864243e39b8d0559f820c342860754



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

Reply via email to