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

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

     [ https://issues.apache.org/jira/browse/SPARK-23095?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xiao Li resolved SPARK-23095.
-----------------------------
       Resolution: Fixed
         Assignee: Dilip Biswal
    Fix Version/s: 2.3.0

> 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.2.2, 2.3.0
>            Reporter: Dilip Biswal
>            Assignee: Dilip Biswal
>            Priority: Major
>             Fix For: 2.3.0
>
>
> The following SQL involving scalar correlated query returns a map exception.
> {code:java}
> SELECT t1a
> FROM   t1
> WHERE  t1a = (SELECT   count
>               FROM     t2
>               WHERE    t2c = t1c
>               HAVING   count >= 1)
> {code}
> {code:java}
>  
> 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)
> {code}
> 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