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

Xurenhe commented on CALCITE-4854:
----------------------------------

Hi [~xzh_dz]

Please review this issue, because it is related to 
[CALCITE-4779|https://issues.apache.org/jira/browse/CALCITE-4779], which you 
report.

> SubstitutionVisitor exec aggregate-match fail, which query with grouping 
> literal alone
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4854
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4854
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Xurenhe
>            Priority: Major
>
> This case execute SubstitutionVisitor fail, but it need be mv-match.
>  
> {code:java}
> //org.apache.calcite.test.MaterializedViewSubstitutionVisitorTest#test
> @Test void test() {
>   final String mv = ""
>       + "select \"deptno\", \"empid\", count(*)\n"
>       + "from \"emps\"\n"
>       + "group by \"deptno\", \"empid\"";
>   final String query = ""
>       + "select '1', count(*)\n"
>       + "from \"emps\"\n"
>       + "group by '1'";
>   sql(mv, query).ok();
> }
> {code}
>  
>  
> I found that 
> [CALCITE-4779|https://issues.apache.org/jira/browse/CALCITE-4779] have done 
> some pre-handler to canonicalize query's relnode, but it‘s not applicable for 
> this test case.
> Because, AGGREGATE_PROJECT_PULL_UP_CONSTANTS will stop to transform, if size 
> of grouping is one.
> So, I try to enhance UnifyRules to support it.
>  * AggregateToAggregateUnifyRule
>  * AggregateOnCalcToAggregateUnifyRule
>  
> Hi community, Is my solution correct?



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

Reply via email to