martin-g commented on code in PR #3618:
URL: https://github.com/apache/datafusion-comet/pull/3618#discussion_r2872570881
##########
spark/src/main/spark-3.4/org/apache/comet/shims/CometExprShim.scala:
##########
@@ -43,6 +45,9 @@ trait CometExprShim extends CommonStringExprs {
// Right child is the encoding expression.
stringDecode(expr, s.charset, s.bin, inputs, binding)
+ case _ if expr.getClass.getSimpleName == "SecondOfTime" =>
Review Comment:
1. Using the simpleName could return `true` for a totally unrelated class
2. It seems you have not tested your suggested changes because the name of
the class is Second**s**OfTime
(https://github.com/apache/spark/blob/b38e8eaece84e80687ab1f707859c1e5ee7e4c9f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala#L354)
##########
spark/src/main/scala/org/apache/comet/serde/strings.scala:
##########
@@ -408,4 +408,50 @@ trait CommonStringExprs {
None
}
}
+
+ def secondOfTimeToProto(
Review Comment:
This method should probably be moved to datetime.scala instead.
##########
spark/src/main/scala/org/apache/comet/serde/strings.scala:
##########
@@ -408,4 +408,50 @@ trait CommonStringExprs {
None
}
}
+
+ def secondOfTimeToProto(
+ expr: Expression,
+ inputs: Seq[Attribute],
+ binding: Boolean): Option[Expr] = {
+ val childOpt = expr.children.headOption.orElse {
+ withInfo(expr, "SecondOfTime has no child expression")
+ None
+ }
+
+ childOpt.flatMap { child =>
+ val timeZoneId = {
+ val exprClass = expr.getClass
+ try {
+ val timeZoneIdMethod = exprClass.getMethod("timeZoneId")
+ timeZoneIdMethod.invoke(expr).asInstanceOf[Option[String]]
+ } catch {
+ case _: NoSuchMethodException =>
Review Comment:
```suggestion
case _: NoSuchMethodException | _: SecurityException =>
```
--
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]