0lai0 commented on code in PR #3804:
URL: https://github.com/apache/datafusion-comet/pull/3804#discussion_r3063417397


##########
spark/src/main/scala/org/apache/comet/serde/datetime.scala:
##########
@@ -589,6 +589,36 @@ object CometDateFormat extends 
CometExpressionSerde[DateFormatClass] {
   }
 }
 
+/**
+ * Converts a timestamp to the number of hours since Unix epoch (1970-01-01 
00:00:00 UTC). This is
+ * a V2 partition transform expression.
+ *
+ * Both TimestampType and TimestampNTZType use direct division of the raw 
microsecond value
+ * without applying any session timezone offset.
+ */
+object CometHours extends CometExpressionSerde[Hours] {
+  override def convert(
+      expr: Hours,
+      inputs: Seq[Attribute],
+      binding: Boolean): Option[ExprOuterClass.Expr] = {
+    val childExpr = exprToProtoInternal(expr.child, inputs, binding)
+
+    if (childExpr.isDefined) {

Review Comment:
   Fixed. Added explicit type checking to only allow TimestampType and 
TimestampNTZType, and it will now fall back for other types similarly to 
`CometDays`.



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