gengliangwang commented on code in PR #45822:
URL: https://github.com/apache/spark/pull/45822#discussion_r1548927521
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -1235,11 +1235,13 @@ object TryToTimestampExpressionBuilder extends
ExpressionBuilder {
override def build(funcName: String, expressions: Seq[Expression]):
Expression = {
val numArgs = expressions.length
if (numArgs == 1 || numArgs == 2) {
- ParseToTimestamp(
+ // The expression ParseToTimestamp will throw an SparkUpgradeException
if the input is invalid
+ // even when failOnError is false. We need to catch the exception and
return null.
+ TryEval(ParseToTimestamp(
Review Comment:
> I'm not sure why try_to_timestamp need a different behavior with
to_timestamp non-ansi mode.
The try_* functions are supposed to return null on invalid inputs, instead
of compatible with non-ansi mode. cc @srielau on this one.
--
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]