gengliangwang commented on code in PR #45822:
URL: https://github.com/apache/spark/pull/45822#discussion_r1548887170
##########
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:
So in `ToTimestamp`, there is supposed to be a `SparkUpgradeException` even
when `failOnError`is false.
To avoid swallowing all errors, we can add another flag `isTryFunction`
besides `failOnError`. It will make the code more complicated though.
--
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]