You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2026/06/10 11:52:20 UTC

Re: [PR] [SPARK-49642][SQL] Remove the ANSI config suggestion in DATETIME_FIEL… [spark]

MaxGekk commented on code in PR #54695:
URL: https://github.com/apache/spark/pull/54695#discussion_r3388011735


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -305,10 +305,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE
 
   def ansiDateTimeArgumentOutOfRange(e: Exception): SparkDateTimeException = {
     new SparkDateTimeException(
-      errorClass = "DATETIME_FIELD_OUT_OF_BOUNDS.WITH_SUGGESTION",
-      messageParameters = Map(
-        "rangeMessage" -> e.getMessage,
-        "ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)),
+      errorClass = "DATETIME_FIELD_OUT_OF_BOUNDS.WITHOUT_SUGGESTION",

Review Comment:
   After this change, `ansiDateTimeArgumentOutOfRangeWithoutSuggestion` (lines 315–322) has an identical implementation to this method — same `errorClass`, same `messageParameters`, same `context`/`summary`/`cause`. The only remaining difference is the parameter type (`Throwable` vs `Exception`). The `WithoutSuggestion` suffix used to encode a real behavioral distinction; that distinction is gone now that both methods throw `WITHOUT_SUGGESTION`.
   
   Suggested fix (self-contained in this PR):
   1. Widen this method's parameter to `Throwable` (all callers pass `DateTimeException`/`RuntimeException`, compatible on both the Java and Scala sides).
   2. Delete `ansiDateTimeArgumentOutOfRangeWithoutSuggestion` (lines 315–322).
   3. Replace its 3 call sites in `DateTimeUtils.scala` (lines 940, 955, 957) with `ansiDateTimeArgumentOutOfRange`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org