vinodkc commented on code in PR #53370:
URL: https://github.com/apache/spark/pull/53370#discussion_r2600777520


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala:
##########
@@ -770,6 +770,22 @@ abstract class IntegralToTimeBase
     val nanos = Math.multiplyExact(input.asInstanceOf[Number].longValue(), 
upScaleFactor)
     validateTimeNanos(nanos)
   }
+
+  override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): 
ExprCode = {
+    nullSafeCodeGen(ctx, ev, c => {
+      val nanos = if (upScaleFactor == 1) {
+        c
+      } else {
+        s"java.lang.Math.multiplyExact($c, ${upScaleFactor}L)"
+      }
+      s"""
+         |${ev.value} = $nanos;
+         |if (${ev.value} < 0L || ${ev.value} >= ${NANOS_PER_DAY}L) {
+         |  ${ev.isNull} = true;

Review Comment:
   Thanks for the review.  I totally missed that scenario.
   I've added ANSI befaviour now.



-- 
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]

Reply via email to