[jira] [Created] (FLINK-11416) DISTINCT on a JOIN inside of an UNION is not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-11416) DISTINCT on a JOIN inside of an UNION is not working

Shang Yuanchun (Jira)
Elias Saalmann created FLINK-11416:
--------------------------------------

             Summary: DISTINCT on a JOIN inside of an UNION is not working
                 Key: FLINK-11416
                 URL: https://issues.apache.org/jira/browse/FLINK-11416
             Project: Flink
          Issue Type: Bug
          Components: Table API & SQL
    Affects Versions: 1.7.1, 1.7.0
            Reporter: Elias Saalmann


I get an error (Error while applying rule AggregateUnionAggregateRule) when having a DISTINCT on a result of a JOIN within an UNION, e.g.

(
   SELECT DISTINCT c
   FROM a JOIN b ON a = b
 )
 UNION
 (
   SELECT c
   FROM c
 )

Full stacktrace:


Exception in thread "main" java.lang.RuntimeException: Error while applying rule AggregateUnionAggregateRule, args [rel#197:LogicalAggregate.NONE(input=rel#196:Subset#21.NONE,group=\{0}), rel#194:LogicalUnion.NONE(input#0=rel#188:Subset#18.NONE,input#1=rel#189:Subset#19.NONE,all=true), rel#221:LogicalAggregate.NONE(input=rel#184:Subset#16.NONE,group=\{2}), rel#164:LogicalTableScan.NONE(table=[_DataSetTable_2])]
    at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:236)
    at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:646)
    at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339)
    at org.apache.flink.table.api.TableEnvironment.runVolcanoPlanner(TableEnvironment.scala:373)
    at org.apache.flink.table.api.TableEnvironment.optimizeLogicalPlan(TableEnvironment.scala:292)
    at org.apache.flink.table.api.BatchTableEnvironment.optimize(BatchTableEnvironment.scala:455)
    at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:475)
    at org.apache.flink.table.api.java.BatchTableEnvironment.toDataSet(BatchTableEnvironment.scala:165)
    at org.myorg.quickstart.TableJob1.main(TableJob1.java:51)
Caused by: java.lang.IllegalArgumentException: Cannot compute compatible row type for arguments to set op: RecordType(VARCHAR(65536) a, VARCHAR(65536) b, VARCHAR(65536) c), RecordType(VARCHAR(65536) d)
    at org.apache.calcite.rel.core.SetOp.deriveRowType(SetOp.java:111)
    at org.apache.calcite.rel.AbstractRelNode.getRowType(AbstractRelNode.java:222)
    at org.apache.calcite.tools.RelBuilder$Frame.<init>(RelBuilder.java:2065)
    at org.apache.calcite.tools.RelBuilder$Frame.<init>(RelBuilder.java:2050)
    at org.apache.calcite.tools.RelBuilder.push(RelBuilder.java:243)
    at org.apache.calcite.tools.RelBuilder.setOp(RelBuilder.java:1370)
    at org.apache.calcite.tools.RelBuilder.union(RelBuilder.java:1390)
    at org.apache.calcite.tools.RelBuilder.union(RelBuilder.java:1380)
    at org.apache.calcite.rel.rules.AggregateUnionAggregateRule.onMatch(AggregateUnionAggregateRule.java:130)
    at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:212)
    ... 8 more

Full example reproducing the error: [GitHub|https://github.com/lordon/flink_quickstart/blob/master/src/main/java/org/myorg/quickstart/TableJob1.java]



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