You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ken Geis (JIRA)" <ji...@apache.org> on 2018/05/17 17:26:00 UTC

[jira] [Commented] (FLINK-9395) multiple left outer joins to subqueries with array values fail

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

Ken Geis commented on FLINK-9395:
---------------------------------

It appears that the faulty logic is in {{DataSetJoin.partitionAndSort(..)}}. This sorts the DataSet partitions along the key column then all of the rest of the columns. I'm not sure why it makes sense to sort on more than just the join key. Perhaps helper method {{getFullIndiciesWithPrefix}} [sic] should exclude non-sortable columns.

> multiple left outer joins to subqueries with array values fail
> --------------------------------------------------------------
>
>                 Key: FLINK-9395
>                 URL: https://issues.apache.org/jira/browse/FLINK-9395
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ken Geis
>            Priority: Major
>         Attachments: JoinTest.java
>
>
> Where {{a}} is a table with column {{id}}, the following query succeeds:
> {code:sql}
> SELECT * FROM a
>  LEFT OUTER JOIN (SELECT id, ARRAY[id] AS b FROM a) AS b ON a.id = b.id
> {code}
> I add another join:
> {code:sql}
> SELECT * FROM a
>   LEFT OUTER JOIN (SELECT id, ARRAY[id] AS b FROM a) AS b ON a.id = b.id
>   LEFT OUTER JOIN (SELECT id, ARRAY[id] AS b FROM a) AS c ON a.id = c.id
> {code}
> This fails with the error:
> {noformat}
> org.apache.flink.api.common.InvalidProgramException: Selected sort key is not a sortable type
>         at org.apache.flink.api.java.operators.SortPartitionOperator.ensureSortableKey(SortPartitionOperator.java:145)
>         at org.apache.flink.api.java.operators.SortPartitionOperator.sortPartition(SortPartitionOperator.java:111)
>         at org.apache.flink.table.plan.nodes.dataset.DataSetJoin$$anonfun$partitionAndSort$1.apply(DataSetJoin.scala:466)
>         at org.apache.flink.table.plan.nodes.dataset.DataSetJoin$$anonfun$partitionAndSort$1.apply(DataSetJoin.scala:465)
>         at scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:57)
>         at scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:66)
>         at scala.collection.mutable.ArrayOps$ofInt.foldLeft(ArrayOps.scala:234)
>         at org.apache.flink.table.plan.nodes.dataset.DataSetJoin.partitionAndSort(DataSetJoin.scala:465)
>         at org.apache.flink.table.plan.nodes.dataset.DataSetJoin.addLeftOuterJoin(DataSetJoin.scala:268)
>         at org.apache.flink.table.plan.nodes.dataset.DataSetJoin.translateToPlan(DataSetJoin.scala:176)
>         at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:399)
>         at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:378)
>         at org.apache.flink.table.api.java.BatchTableEnvironment.toDataSet(BatchTableEnvironment.scala:146)
> {noformat}



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