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

ASF GitHub Bot commented on FLINK-5144:
---------------------------------------

GitHub user KurtYoung opened a pull request:

    https://github.com/apache/flink/pull/3062

    [FLINK-5144] Fix error while applying rule AggregateJoinTransposeRule

    There are two calcite's issues related.
    One is during calcite's decorrelation, there will be an assertion error: 
https://issues.apache.org/jira/browse/CALCITE-1543.
    Another one is about the AggregateJoinTransposeRule, looks like the rule 
has changed the output RowType unexpectedly: 
https://issues.apache.org/jira/browse/CALCITE-1544.
    
    I have fixed these two issues in calcite, but it won't be included util 
calcite 1.12.0. So i copied two related classes and do a early fix in flink's 
codes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/KurtYoung/flink flink-5144

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3062.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3062
    
----
commit a97246af69282e981f3247f5f83b0c54ded9043a
Author: kete.yangkt <kete.yan...@alibaba-inc.com>
Date:   2017-01-05T03:32:04Z

    [FLINK-5144] Fix error while applying rule AggregateJoinTransposeRule

----


> Error while applying rule AggregateJoinTransposeRule
> ----------------------------------------------------
>
>                 Key: FLINK-5144
>                 URL: https://issues.apache.org/jira/browse/FLINK-5144
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Kurt Young
>
> AggregateJoinTransposeRule seems to cause errors. We have to investigate if 
> this is a Flink or Calcite error. Here a simplified example:
> {code}
> select
>   sum(l_extendedprice)
> from
>   lineitem,
>   part
> where
>   p_partkey = l_partkey
>   and l_quantity < (
>     select
>       avg(l_quantity)
>     from
>       lineitem
>     where
>       l_partkey = p_partkey
>   )
> {code}
> Exception:
> {code}
> Exception in thread "main" java.lang.AssertionError: Internal error: Error 
> occurred while applying rule AggregateJoinTransposeRule
>       at org.apache.calcite.util.Util.newInternal(Util.java:792)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:148)
>       at 
> org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:225)
>       at 
> org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:342)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:213)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:819)
>       at 
> org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:334)
>       at 
> org.apache.flink.api.table.BatchTableEnvironment.optimize(BatchTableEnvironment.scala:251)
>       at 
> org.apache.flink.api.table.BatchTableEnvironment.translate(BatchTableEnvironment.scala:286)
>       at 
> org.apache.flink.api.scala.table.BatchTableEnvironment.toDataSet(BatchTableEnvironment.scala:139)
>       at 
> org.apache.flink.api.scala.table.package$.table2RowDataSet(package.scala:77)
>       at 
> org.apache.flink.api.scala.sql.tpch.TPCHQueries$.runQ17(TPCHQueries.scala:826)
>       at 
> org.apache.flink.api.scala.sql.tpch.TPCHQueries$.main(TPCHQueries.scala:57)
>       at 
> org.apache.flink.api.scala.sql.tpch.TPCHQueries.main(TPCHQueries.scala)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
> Caused by: java.lang.AssertionError: Type mismatch:
> rowtype of new rel:
> RecordType(BIGINT l_partkey, BIGINT p_partkey) NOT NULL
> rowtype of set:
> RecordType(BIGINT p_partkey) NOT NULL
>       at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
>       at org.apache.calcite.plan.RelOptUtil.equal(RelOptUtil.java:1838)
>       at org.apache.calcite.plan.volcano.RelSubset.add(RelSubset.java:273)
>       at org.apache.calcite.plan.volcano.RelSet.add(RelSet.java:148)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.addRelToSet(VolcanoPlanner.java:1820)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1766)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:1032)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1052)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1942)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:136)
>       ... 17 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to