cloud-fan commented on a change in pull request #33076:
URL: https://github.com/apache/spark/pull/33076#discussion_r658484384
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -1749,19 +1756,22 @@ case class TimestampAddYMInterval(
override def toString: String = s"$left + $right"
override def sql: String = s"${left.sql} + ${right.sql}"
- override def inputTypes: Seq[AbstractDataType] = Seq(TimestampType,
YearMonthIntervalType)
+ override def inputTypes: Seq[AbstractDataType] =
+ Seq(TypeCollection.AllTimestampTypes, YearMonthIntervalType)
override def dataType: DataType = TimestampType
override def withTimeZone(timeZoneId: String): TimeZoneAwareExpression =
copy(timeZoneId = Option(timeZoneId))
+ @transient private lazy val zoneIdInEval: ZoneId =
zoneIdForType(left.dataType)
+
override def nullSafeEval(micros: Any, months: Any): Any = {
- timestampAddMonths(micros.asInstanceOf[Long], months.asInstanceOf[Int],
zoneId)
+ timestampAddMonths(micros.asInstanceOf[Long], months.asInstanceOf[Int],
zoneIdInEval)
}
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
- val zid = ctx.addReferenceObj("zoneId", zoneId, classOf[ZoneId].getName)
+ val zid = ctx.addReferenceObj("zoneIdInEval", zoneIdInEval,
classOf[ZoneId].getName)
Review comment:
ditto
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]