Skip to content

Commit ff6b1a9

Browse files
the-sakthiMaxGekk
authored andcommitted
[SPARK-49639][SQL] Remove the ANSI config suggestion in INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION
### What changes were proposed in this pull request? Removal of ANSI turn off suggestion for INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION error ### Why are the changes needed? Now that in Spark 4.0.0 we have moved to ANSI mode on by default, we want to keep suggestions of this kind to the minimum. ### Does this PR introduce _any_ user-facing change? Yes, error message has changed. ### How was this patch tested? Existing tests. ### Was this patch authored or co-authored using generative AI tooling? No, Closes #49655 from the-sakthi/SPARK-49639. Authored-by: Sakthi Vel <[email protected]> Signed-off-by: Max Gekk <[email protected]>
1 parent a45eb2b commit ff6b1a9

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

common/utils/src/main/resources/error/error-conditions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@
27432743
},
27442744
"INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION" : {
27452745
"message" : [
2746-
"Cannot add an interval to a date because its microseconds part is not 0. If necessary set <ansiConfig> to \"false\" to bypass this error."
2746+
"Cannot add an interval to a date because its microseconds part is not 0. To resolve this, cast the input date to a timestamp, which supports the addition of intervals with non-zero microseconds."
27472747
],
27482748
"sqlState" : "22006"
27492749
},

sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE
287287
}
288288

289289
def invalidIntervalWithMicrosecondsAdditionError(): SparkIllegalArgumentException = {
290-
new SparkIllegalArgumentException(
291-
errorClass = "INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION",
292-
messageParameters = Map("ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)))
290+
new SparkIllegalArgumentException(errorClass = "INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION")
293291
}
294292

295293
def overflowInSumOfDecimalError(

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
436436
withSQLConf((SQLConf.ANSI_ENABLED.key, "true")) {
437437
checkErrorInExpression[SparkIllegalArgumentException](
438438
DateAddInterval(Literal(d), Literal(new CalendarInterval(1, 1, 25 * MICROS_PER_HOUR))),
439-
"INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION",
440-
Map("ansiConfig" -> "\"spark.sql.ansi.enabled\""))
439+
"INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION")
441440
}
442441

443442
withSQLConf((SQLConf.ANSI_ENABLED.key, "false")) {

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ class DateTimeUtilsSuite extends SparkFunSuite with Matchers with SQLHelper {
542542
checkError(
543543
exception = intercept[SparkIllegalArgumentException](
544544
dateAddInterval(input, new CalendarInterval(36, 47, 1))),
545-
condition = "INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION",
546-
parameters = Map("ansiConfig" -> "\"spark.sql.ansi.enabled\""))
545+
condition = "INVALID_INTERVAL_WITH_MICROSECONDS_ADDITION")
547546
}
548547

549548
test("timestamp add interval") {

0 commit comments

Comments
 (0)