cloud-fan commented on a change in pull request #28534:
URL: https://github.com/apache/spark/pull/28534#discussion_r428020320
##########
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 {
Review comment:
This reminds me of https://github.com/apache/spark/pull/27965
In general I think we want to be conservative and don't rely on the implicit
cast too much. We can support string literal as a special case later, via the
framework.
For this case, how about we follow `DateAdd`? i.e.
1. implements `ExpectsInputTypes`
2. declare `IntegralType` as the input type
3. in `eval`, cast value to long via `value.asInstanceOf[Number].intValue()`
4. in codegen, cast value to long via`Math.multiplyExact((long) v, scale)`
----------------------------------------------------------------
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]