anchovYu commented on code in PR #36241:
URL: https://github.com/apache/spark/pull/36241#discussion_r852621626


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala:
##########
@@ -626,7 +626,7 @@ object Decimal {
       }
     } catch {
       case _: NumberFormatException =>
-        throw QueryExecutionErrors.invalidInputSyntaxForNumericError(str, 
errorContext)
+        throw 
QueryExecutionErrors.invalidInputSyntaxForNumericError(DecimalType, str, 
errorContext)

Review Comment:
   I didn't do it initially, because I think `fromStringANSI` and 
`changePrecision` are two separate processes and has its corresponding 
exceptions. The former has an exception to cast from a string to a BigDecimal, 
and at this step, the `target` DecimalType doesn't appear. While the latter has 
exception to change precision, where `target` starts to take place.
   
   But maybe even though these are two steps, they are always called together 
serially. Thus, having the `target` information in the first stage seems fine. 
It also saves a lot of trouble in `AbstractDataType` etc. Will update the PR.



-- 
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