You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "junheleo (Jira)" <ji...@apache.org> on 2023/06/06 01:31:00 UTC
[jira] [Commented] (CALCITE-5742) SubstitutionVisitor Causes Infinite Loop when using AggregateOnCalcToAggregateUnifyRule
[ https://issues.apache.org/jira/browse/CALCITE-5742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729542#comment-17729542 ]
junheleo commented on CALCITE-5742:
-----------------------------------
Hi,[~julianhyde] ,would you like to help me review this problem and PR pls?
> SubstitutionVisitor Causes Infinite Loop when using AggregateOnCalcToAggregateUnifyRule
> ---------------------------------------------------------------------------------------
>
> Key: CALCITE-5742
> URL: https://issues.apache.org/jira/browse/CALCITE-5742
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: junheleo
> Priority: Major
> Labels: pull-request-available
>
> Here is a simple code snippet to reproduce the issue:
> {code:java}
> // Test case in MaterializedViewSubstitutionVisitorTest
> @Test void testAggregateOnProject6() {
> sql("select count(1) from (select \"empid\", \"deptno\", \"name\", count(*) from \"emps\""
> + "group by \"empid\", \"deptno\", \"name\" limit 10) ",
> "select \"empid\", \"deptno\" from (select \"empid\", \"deptno\", \"name\", count(*) from \"emps\"\n"
> + "group by \"empid\", \"deptno\", \"name\" limit 10) group by \"empid\", \"deptno\"")
> .noMat();
> }{code}
> Canonicalized Query Plan:
> {code:java}
> -- Query Plan
> LogicalAggregate(group=[{0, 1}])
> LogicalCalc(expr#0..3=[{inputs}], proj#0..1=[{exprs}])
> LogicalSort(fetch=[10])
> LogicalAggregate(group=[{0, 1, 2}], EXPR$3=[COUNT()])
> LogicalCalc(expr#0..4=[{inputs}], proj#0..2=[{exprs}])
> LogicalTableScan(table=[[hr, emps]]){code}
> Canonicalized Target Plan:
> {code:java}
> -- Target Plan
> LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
> LogicalSort(fetch=[10])
> LogicalAggregate(group=[{0, 1, 2}], EXPR$3=[COUNT()])
> LogicalCalc(expr#0..4=[{inputs}], proj#0..2=[{exprs}])
> LogicalTableScan(table=[[hr, emps]]){code}
> The input of Calc Under Aggregate was changed when executing permute in AggregateOnCalcToAggregateUnifyRule, then Visitor can not skip out because the condition "queryDescendant == r.after" is not met.
> Thank you for your attention to this matter
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)