You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Sergey Nuyanzin (JIRA)" <ji...@apache.org> on 2018/08/06 14:29:00 UTC

[jira] [Comment Edited] (CALCITE-2448) AggregateProjectPullUpConstantsRule throws AssertionError

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

Sergey Nuyanzin edited comment on CALCITE-2448 at 8/6/18 2:28 PM:
------------------------------------------------------------------

is it possible also to have testcase here?
I ask for it because I did test of the query from the description on master (commit 7088dc7) and it works. Also added a script to agg.iq and it works well. E.g.
{code}select 'a',-emp.deptno from emp where 'a' is null group by 'a',-emp.deptno;
+--------+--------+
| EXPR$0 | EXPR$1 |
+--------+--------+
+--------+--------+
(0 rows)

!ok{code}
It would be great to have a reproducible test in *.iq or in {{SqlOperatorBaseTest}}



was (Author: sergey nuyanzin):
is it possible also to have testcase here?
I ask for it because I did test of the query from the description on master (commit 7088dc7) and it works. Also added a script to agg.iq and it works well.
It would be great to have a reproducible test in *.iq or in {{SqlOperatorBaseTest}}


> AggregateProjectPullUpConstantsRule throws AssertionError
> ---------------------------------------------------------
>
>                 Key: CALCITE-2448
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2448
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: pengzhiwei
>            Assignee: Julian Hyde
>            Priority: Major
>         Attachments: 屏幕快照 2018-08-06 下午9.09.15.png, 屏幕快照 2018-08-06 下午9.13.56.png, 屏幕快照 2018-08-06 下午9.19.48.png, 屏幕快照 2018-08-06 下午9.19.48.png
>
>
> In the sql as followed:
> {code:java}
> select 'a',-emp.deptno from emp where 'a' is null group by 'a',-emp.deptno
> {code}
> The AggregateProjectPullUpConstantsRule throws an Error like this:
> {code:java}
> java.lang.AssertionError: Cannot add expression of different type to set:
> set type is RecordType(CHAR(1) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL EXPR$0, INTEGER NOT NULL EXPR$1) NOT NULL
> expression type is RecordType(CHAR(1) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL EXPR$0, CHAR(1) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL EXPR$1) NOT NULL
> set is rel#9:LogicalAggregate(input=HepRelVertex#8,group={0, 1})
> expression is LogicalProject#11
> at org.apache.calcite.plan.RelOptUtil.verifyTypeEquivalence(RelOptUtil.java:380)
> at org.apache.calcite.plan.hep.HepRuleCall.transformTo(HepRuleCall.java:57)
> at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:234)
> at org.apache.calcite.rel.rules.AggregateProjectPullUpConstantsRule.onMatch(AggregateProjectPullUpConstantsRule.java:194)
> at 
> org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:315)
> {code}
> The reason is that the relBuilder#aggregate failed to generate new aggregate node when the filer condition is always false,just return as followed in RelBuilder:
> !屏幕快照 2018-08-06 下午9.09.15.png!
> And then the project created later after relBuilder#aggregate is not really based on the  aggregate node in AggregateProjectPullUpConstantsRule which result in the error.
> !屏幕快照 2018-08-06 下午9.13.56.png!
> I fix the problem by add a logic if the relBuilder#aggregate has not generated a aggregate node then just return this rule in AggregateProjectPullUpConstantsRule ,just like this:
> !屏幕快照 2018-08-06 下午9.19.48.png!
> Can you have check for me,thanks!
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)