You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dilip Biswal (JIRA)" <ji...@apache.org> on 2018/01/16 21:13:00 UTC

[jira] [Created] (SPARK-23095) Decorrelation of scalar subquery fails with java.util.NoSuchElementException.

Dilip Biswal created SPARK-23095:
------------------------------------

             Summary: Decorrelation of scalar subquery fails with java.util.NoSuchElementException.
                 Key: SPARK-23095
                 URL: https://issues.apache.org/jira/browse/SPARK-23095
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.3.0
            Reporter: Dilip Biswal


The following SQL involving scalar correlated query returns a map exception.

 

SELECT t1a

FROM   t1

WHERE  t1a = (SELECT   count(*)

              FROM     t2

              WHERE    t2c = t1c

              HAVING   count(*) >= 1)

 

key not found: ExprId(278,786682bb-41f9-4bd5-a397-928272cc8e4e)

java.util.NoSuchElementException: key not found: ExprId(278,786682bb-41f9-4bd5-a397-928272cc8e4e)

        at scala.collection.MapLike$class.default(MapLike.scala:228)

        at scala.collection.AbstractMap.default(Map.scala:59)

        at scala.collection.MapLike$class.apply(MapLike.scala:141)

        at scala.collection.AbstractMap.apply(Map.scala:59)

        at org.apache.spark.sql.catalyst.optimizer.RewriteCorrelatedScalarSubquery$.org$apache$spark$sql$catalyst$optimizer$RewriteCorrelatedScalarSubquery$$evalSubqueryOnZeroTups(subquery.scala:378)

        at org.apache.spark.sql.catalyst.optimizer.RewriteCorrelatedScalarSubquery$$anonfun$org$apache$spark$sql$catalyst$optimizer$RewriteCorrelatedScalarSubquery$$constructLeftJoins$1.apply(subquery.scala:430)

        at org.apache.spark.sql.catalyst.optimizer.RewriteCorrelatedScalarSubquery$$anonfun$org$apache$spark$sql$catalyst$optimizer$RewriteCorrelatedScalarSubquery$$constructLeftJoins$1.apply(subquery.scala:426)

 

In this case, after evaluating the HAVING clause "count(*) > 1" statically

against the binding of aggregtation result on empty input, we determine

that this query will not have a the count bug. We should simply return

the evalSubqueryOnZeroTups with empty value.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org