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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to