[ https://issues.apache.org/jira/browse/SPARK-23095?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Apache Spark reassigned SPARK-23095: ------------------------------------ Assignee: Apache Spark > 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 > Assignee: Apache Spark > Priority: Major > > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org