the-sakthi commented on code in PR #50296:
URL: https://github.com/apache/spark/pull/50296#discussion_r2001062893


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala:
##########
@@ -120,3 +121,53 @@ case class ToTimeParser(fmt: Option[String]) {
     }
   }
 }
+
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = """
+    _FUNC_(time_expr) - Returns the minute component of the given time.
+  """,
+  examples = """
+    Examples:
+      > SELECT _FUNC_(TIME'12:58:59');
+       58
+  """,
+  since = "4.1.0",
+  group = "datetime_funcs")
+// scalastyle:on line.size.limit
+case class MinutesOfTime(child: Expression)
+  extends RuntimeReplaceable
+    with ExpectsInputTypes {
+
+  override def replacement: Expression = StaticInvoke(
+    classOf[DateTimeUtils.type],
+    IntegerType,
+    "getMinutesOfTime",
+    Seq(child),
+    Seq(child.dataType)

Review Comment:
   I'm running into code generation issues here. For e.g: `Cannot generate code 
for expression: minutes_of_time(13:52:57.421543)`
   
   I tried updating the StaticInvoke call to use `Seq(Cast(child, LongType))` 
and `Seq(LongType)` in replacement, but I'm still seeing failures in the 
codegen path. Any suggestions on how to properly handle the TIME → LONG cast 
for codegen, or if there's a simpler workaround, Max?



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

Reply via email to