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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -1011,8 +1013,14 @@ object QueryExecutionErrors extends QueryErrorsBase {
   }
 
   def cannotCastToDateTimeError(value: Any, to: DataType, errorContext: 
String): Throwable = {
-    new DateTimeException(s"Cannot cast $value to $to. To return NULL instead, 
use 'try_cast'. " +
-      s"If necessary set ${SQLConf.ANSI_ENABLED.key} to false to bypass this 
error." + errorContext)
+    new DateTimeException(s"Invalid input syntax for type ${toSQLType(to)}: " +
+      s"${if (value.isInstanceOf[UTF8String]) {

Review Comment:
   nit: let's save the string value to a `val` before line 1016



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