Changes

Summary

  1. [SPARK-33008][SQL] Division by zero on divide-like operations returns (commit: cbd3fde) (details)
Commit cbd3fdea62dab73fc4a96702de8fd1f07722da66 by wenchen
[SPARK-33008][SQL] Division by zero on divide-like operations returns
incorrect result
### What changes were proposed in this pull request? In ANSI mode, when
a division by zero occurs performing a divide-like operation (Divide,
IntegralDivide, Remainder or Pmod), we are returning an incorrect value.
Instead, we should throw an exception, as stated in the SQL standard.
### Why are the changes needed? Result corrupt.
### Does this PR introduce any user-facing change? No.
### How was this patch tested? added UT + existing UTs (improved)
Closes #29882 from luluorta/SPARK-33008.
Authored-by: luluorta <luluorta@gmail.com> Signed-off-by: Wenchen Fan
<wenchen@databricks.com>
(commit: cbd3fde)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/StreamingJoinHelper.scala (diff)
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala (diff)
The file was modifiedsql/core/src/test/scala/org/apache/spark/sql/SparkSessionExtensionSuite.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/udf/postgreSQL/udf-case.sql.out (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Canonicalize.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/bitwiseExpressions.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/inputs/postgreSQL/select_having.sql (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/postgreSQL/int8.sql.out (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/inputs/postgreSQL/case.sql (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/postgreSQL/case.sql.out (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Average.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/udf/postgreSQL/udf-select_having.sql.out (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/inputs/udf/postgreSQL/udf-select_having.sql (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/postgreSQL/select_having.sql.out (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/inputs/udf/postgreSQL/udf-case.sql (diff)
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala (diff)