-
- Downloads
[SPARK-17117][SQL] 1 / NULL should not fail analysis
## What changes were proposed in this pull request? This patch fixes the problem described in SPARK-17117, i.e. "SELECT 1 / NULL" throws an analysis exception: ``` org.apache.spark.sql.AnalysisException: cannot resolve '(1 / NULL)' due to data type mismatch: differing types in '(1 / NULL)' (int and null). ``` The problem is that division type coercion did not take null type into account. ## How was this patch tested? A unit test for the type coercion, and a few end-to-end test cases using SQLQueryTestSuite. Author: petermaxlee <petermaxlee@gmail.com> Closes #14695 from petermaxlee/SPARK-17117.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala 5 additions, 2 deletions...org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala 8 additions, 1 deletion...pache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala
- sql/core/src/test/resources/sql-tests/inputs/arithmetic.sql 10 additions, 2 deletionssql/core/src/test/resources/sql-tests/inputs/arithmetic.sql
- sql/core/src/test/resources/sql-tests/results/arithmetic.sql.out 66 additions, 18 deletions...e/src/test/resources/sql-tests/results/arithmetic.sql.out
Please register or sign in to comment