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

Xurenhe commented on CALCITE-5000:
----------------------------------

[~julianhyde] 
English is not my mother tongue, and I am very sorry to confuse you.
This issue want to eliminate deterministic agg-call, if its arg exists in the 
group.
For example: 
{code:java}
// origin sql
select max(c1) from tbl group by c1, c2;
// optimized sql
select c1 from tbl group by c1, c2;{code}


How about "Reduce some deterministic agg-calls by its group"?

> Expand rule of `AGGREGATE_REDUCE_FUNCTIONS`, when arg of agg-call is in the 
> aggregate's group
> ---------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5000
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5000
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Xurenhe
>            Assignee: Xurenhe
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.31.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Using calcite's SubstitutionVisitor, we need do a lot work about 
> canonicalizing relnode.
> Some sql should be simplified.
> {noformat}
> -- origin sql
> select deptno, salary, max(salary), min(commission) 
> from emps 
> group by deptno, salary
> -- simplified
> select deptno, salary, salary as expr, min(commission) 
> from emps 
> group by deptno, salary{noformat}
> It should be simplified, but I didn't find any rule to simplify it.
> This issue is related to CALCITE-4857



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to