TJX2014 commented on a change in pull request #28534:
URL: https://github.com/apache/spark/pull/28534#discussion_r427859032
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -401,6 +401,78 @@ case class DayOfYear(child: Expression) extends
UnaryExpression with ImplicitCas
}
}
+abstract class NumberToTimestampBase extends UnaryExpression
+ with ImplicitCastInputTypes {
+
+ protected def upScaleFactor: Long
+
+ override def inputTypes: Seq[AbstractDataType] = Seq(LongType)
+
+ override def dataType: DataType = TimestampType
+
+ override def nullSafeEval(input: Any): Any = {
+ Math.multiplyExact(input.asInstanceOf[Long], upScaleFactor)
+ }
+
+ override protected def doGenCode(ctx: CodegenContext, ev: ExprCode):
ExprCode = {
+ defineCodeGen(ctx, ev, _ => s"java.lang.Math.multiplyExact(" +
+ s"${ev.value}, ${upScaleFactor})")
Review comment:
Ok, `${upScaleFactor}` -> `$upScaleFactor`, good job
----------------------------------------------------------------
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]