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

Xurenhe edited comment on CALCITE-4817 at 10/8/21, 12:15 PM:
-------------------------------------------------------------

[~Ziwei Liu] 
 Thanks for reminding me.
  
 This is really a bug. I didn't consider this situation, before making pr.

I reconsidered the problem, and I describe this situation in another 
issue(CALCITE-4735)

And make a PR to fix it.

pr: [https://github.com/apache/calcite/pull/2522/files]

Related test case as follow:

!image-2021-10-08-20-14-10-791.png!

Step1: Try to find rollup agg-call

Step2: Try to build a agg-call by target's grouping, if step1 is fail.

-----------------------

Thank you to remind me again.
 I'm prettifying the code.

Could you take a time to review pr, after finishing.:)

 


was (Author: wojustme):
[~Ziwei Liu] 
 Thanks for reminding me.
 
This is really a bug. I didn't consider this situation, before making pr.

I reconsidered the problem, and I describe this situation in another 
issue([CALCITE-4735|https://issues.apache.org/jira/browse/CALCITE-4735])

And make a PR to fix it.

pr: [https://github.com/apache/calcite/pull/2522/files]

Related test case as follow:

!image-2021-10-08-18-48-56-093.png!

-----------------------

Thank you to remind me again.
I'm prettifying the code.

Could you take a time to review pr, after finishing.:)

 

> Expand SubstitutionVisitor of Aggregate with max/min, which column is the 
> group by list of target
> -------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4817
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4817
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Xurenhe
>            Assignee: Xurenhe
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>         Attachments: image-2021-10-08-18-48-56-093.png, 
> image-2021-10-08-20-14-10-791.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Now, SubstitutionVisitor support `Query with distinct aggregate on the column 
> is matched to the group list existing in target`, as CALCITE-4374 describes.
> But. It's fail, when query aggregate with max/min based on the column, which 
> is in the group by list of target.
> Materialized view recognition should also success.
> {code:java}
> //代码占位符
> @Test void testQueryNoDistinctOptionalityAggCallColInTargetGroupBy1() {
>   final String mv = ""
>       + "select \"name\", \"deptno\" "
>       + "from \"emps\" group by \"name\", \"deptno\"";
>   final String query = ""
>       + "select \"name\", min(\"deptno\")\n"
>       + "from \"emps\" group by \"name\"";
>   sql(mv, query).ok();
> }
> {code}



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

Reply via email to