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

Xurenhe edited comment on CALCITE-4857 at 10/19/21, 5:59 AM:
-------------------------------------------------------------

[~yanlin-Lynn] [~nobigo] 
 Thanks for your reply. 

[~yanlin-Lynn] I agree with your advise to simplify query's plan, which is only 
working in simple group type of aggregate.

I give a complex case as follow:
{code:java}
//代码占位符
– mv: select deptno, salary, min(commission) as commission_min 
from emps 
group by deptno, salary 
– query: select deptno, salary, max(salary), min(commission) 
from emps 
group by cube(deptno, salary)
{code}
----
Thanks your remind, I think simplified rule is same important.

 


was (Author: wojustme):
[~yanlin-Lynn] [~nobigo] 
 Thanks for your reply. 

[~yanlin-Lynn] I agree with your advise to simplify query's plan, which is only 
working in simple group type of aggregate.

I give a complex case as follow:
{code:java}
– mv: 
select deptno, salary, min(commission) as commission_min 
from emps 
group by deptno, salary
– query: 
select deptno, salary, max(salary), min(commission) 
from emps 
group by cube(deptno, salary)
{code}

> Materialization-Failed, query could be grouping mv's agg-call, when executing 
> mv-match.
> ---------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4857
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4857
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Xurenhe
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2021-10-18-11-18-02-312.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Here, query could be rewritten by mv, but it's failed now.
> {code:java}
> -- mv: 
> select deptno, salary, min(commission) as commission_min 
> from emps 
> group by deptno, salary
> -- query: 
> select deptno, salary, max(salary), min(commission) 
> from emps 
> group by deptno, salary
> -- after mv match
> select deptno, salary, max(salary), commission_min
> from mv
> group by deptno, salary, commission_min
> {code}
>  
> !image-2021-10-18-11-18-02-312.png!  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to