[
https://issues.apache.org/jira/browse/SPARK-60746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Max Gekk updated SPARK-60746:
-----------------------------
Affects Version/s: 4.1.0
4.2.0
4.3.0
4.0.0
> Interval division by -1 overflow raises different errors in interpreted and
> generated code
> ------------------------------------------------------------------------------------------
>
> Key: SPARK-60746
> URL: https://issues.apache.org/jira/browse/SPARK-60746
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 4.1.0, 4.0.0, 4.2.0, 4.3.0, 5.0.0
> Reporter: Max Gekk
> Priority: Major
> Labels: pull-request-available
>
> Under ANSI mode, dividing the minimum ANSI interval by -1 overflows. The
> interpreted and code-generated paths of DivideDTInterval and DivideYMInterval
> report the overflow with different error classes and SQLSTATEs:
> - interpreted (IntervalDivide.checkDivideOverflow):
> INTERVAL_ARITHMETIC_OVERFLOW.WITH_SUGGESTION, SQLSTATE 22015, "Use
> `try_divide` to tolerate overflow and return NULL instead."
> - generated code (doGenCode): ARITHMETIC_OVERFLOW, SQLSTATE 22003, "Overflow
> in integral divide."
> Reproduction on 4.2.0 (also present on master), with
> spark.sql.ansi.enabled=true:
> CREATE TABLE t USING parquet AS SELECT INTERVAL '-106751991
> 04:00:54.775808' DAY TO SECOND AS i;
> SELECT i / -1 FROM t; -- whole-stage codegen on: ARITHMETIC_OVERFLOW
> (22003)
> -- spark.sql.codegen.wholeStage=false,
> factoryMode=NO_CODEGEN:
> -- INTERVAL_ARITHMETIC_OVERFLOW.WITH_SUGGESTION
> (22015)
> The same holds for a year-month interval at Int.MinValue months. SPARK-50226
> changed the interpreted helper to the interval error class; the generated
> code still calls QueryExecutionErrors.overflowInIntegralDivideError. The
> generated code should raise the same error as the interpreted path.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]