You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2020/04/17 15:56:00 UTC

[jira] [Commented] (BEAM-9522) BeamJoinRel.extractJoinRexNode RexLiteral cannot be cast to RexCall

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

Kenneth Knowles commented on BEAM-9522:
---------------------------------------

This one is pretty simple, conceptually, and the issue with the code is obvous: Our code checks if the join condition is "true" and crashes because CROSS JOIN is not supported. It misses the case where the join condition is false. The code that follows assumes that the condition is a conjunction of equalities.

 - because we assume a conjunction of equalities, we can use 1=2 or false=true, etc, so that is not so bad
 - but building new RexLiterals requires some more plumbing to get a RexBuilder in the right spot

The case for a FULL OUTER JOIN with a false condition is not useless - it is similar to forming a tagged union of two collections.

> BeamJoinRel.extractJoinRexNode RexLiteral cannot be cast to RexCall
> -------------------------------------------------------------------
>
>                 Key: BEAM-9522
>                 URL: https://issues.apache.org/jira/browse/BEAM-9522
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql-zetasql
>            Reporter: Andrew Pilloud
>            Priority: Major
>              Labels: zetasql-compliance
>
> One failure in shard 2, One failure in shard 35
> {code:java}
> java.lang.ClassCastException: org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.rex.RexLiteral cannot be cast to org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.rex.RexCall
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamJoinRel.extractJoinRexNodes(BeamJoinRel.java:304)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamJoinRel$ExtractJoinKeys.expand(BeamJoinRel.java:194)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamJoinRel$ExtractJoinKeys.expand(BeamJoinRel.java:177)
> 	at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:542)
> 	at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:476)
> 	at org.apache.beam.sdk.values.PCollectionList.apply(PCollectionList.java:178)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamCoGBKJoinRel$StandardJoin.expand(BeamCoGBKJoinRel.java:93)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamCoGBKJoinRel$StandardJoin.expand(BeamCoGBKJoinRel.java:86)
> 	at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:542)
> 	at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:493)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils.toPCollection(BeamSqlRelUtils.java:69)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils.lambda$buildPCollectionList$0(BeamSqlRelUtils.java:50)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.Iterator.forEachRemaining(Iterator.java:116)
> 	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils.buildPCollectionList(BeamSqlRelUtils.java:51)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils.toPCollection(BeamSqlRelUtils.java:67)
> 	at org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils.toPCollection(BeamSqlRelUtils.java:39)
> 	at cloud.dataflow.sql.ExecuteQueryServiceServer$SqlComplianceServiceImpl.executeQuery(ExecuteQueryServiceServer.java:288)
> 	at com.google.zetasql.testing.SqlComplianceServiceGrpc$MethodHandlers.invoke(SqlComplianceServiceGrpc.java:423)
> 	at com.google.zetasql.io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:171)
> 	at com.google.zetasql.io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:283)
> 	at com.google.zetasql.io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:711)
> 	at com.google.zetasql.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
> 	at com.google.zetasql.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 	at java.lang.Thread.run(Thread.java:748)
> {code}
> {code}
> Apr 01, 2020 3:55:13 PM cloud.dataflow.sql.ExecuteQueryServiceServer$SqlComplianceServiceImpl executeQuery
> INFO: Processing Sql statement: SELECT R_sub.id as col1, R_sub.a as col2, T_sub.string_val as col3
> FROM (SELECT R.id, R.a FROM R) as R_sub
> FULL JOIN (SELECT T.string_val FROM T) as T_sub on false
> Apr 01, 2020 3:54:46 PM cloud.dataflow.sql.ExecuteQueryServiceServer$SqlComplianceServiceImpl executeQuery
> INFO: Processing Sql statement: SELECT r.*, s.* FROM
> (SELECT x, x FROM (SELECT 2 x)) r FULL JOIN (SELECT 3) s ON false
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)