cloud-fan commented on code in PR #50154: URL: https://github.com/apache/spark/pull/50154#discussion_r1981001564
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala: ########## @@ -2104,11 +2105,13 @@ case class ParseToDate( ansiEnabled: Boolean = SQLConf.get.ansiEnabled) extends RuntimeReplaceable with ImplicitCastInputTypes with TimeZoneAwareExpression { - override lazy val replacement: Expression = format.map { f => - Cast(GetTimestamp(left, f, TimestampType, "try_to_date", timeZoneId, ansiEnabled), DateType, - timeZoneId, EvalMode.fromBoolean(ansiEnabled)) - }.getOrElse(Cast(left, DateType, timeZoneId, - EvalMode.fromBoolean(ansiEnabled))) // backwards compatibility + override lazy val replacement: Expression = withOrigin(origin) { Review Comment: I see. I think the best way is ``` protected def createReplacement ... // implemented by subclasses lazy val replacement = withOrigin(this)(createReplacement) ``` But this needs to change all subclasses. Let's leave it for the future. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org