-
- Downloads
[SPARK-16672][SQL] SQLBuilder should not raise exceptions on EXISTS queries
## What changes were proposed in this pull request? Currently, `SQLBuilder` raises `empty.reduceLeft` exceptions on *unoptimized* `EXISTS` queries. We had better prevent this. ```scala scala> sql("CREATE TABLE t1(a int)") scala> val df = sql("select * from t1 b where exists (select * from t1 a)") scala> new org.apache.spark.sql.catalyst.SQLBuilder(df).toSQL java.lang.UnsupportedOperationException: empty.reduceLeft ``` ## How was this patch tested? Pass the Jenkins tests with a new test suite. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #14307 from dongjoon-hyun/SPARK-16672.
Showing
- sql/core/src/main/scala/org/apache/spark/sql/catalyst/SQLBuilder.scala 7 additions, 2 deletions...main/scala/org/apache/spark/sql/catalyst/SQLBuilder.scala
- sql/hive/src/test/resources/sqlgen/predicate_subquery.sql 4 additions, 0 deletionssql/hive/src/test/resources/sqlgen/predicate_subquery.sql
- sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala 10 additions, 0 deletions...org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
Please register or sign in to comment