coderfender commented on code in PR #4111:
URL: https://github.com/apache/datafusion-comet/pull/4111#discussion_r3193319514


##########
spark/src/main/scala/org/apache/comet/serde/unixtime.scala:
##########
@@ -48,17 +63,18 @@ object CometFromUnixTime extends 
CometExpressionSerde[FromUnixTime] {
     val formatExpr = exprToProtoInternal(Literal("%Y-%m-%d %H:%M:%S"), inputs, 
binding)
     val timeZone = exprToProtoInternal(Literal(expr.timeZoneId.orNull), 
inputs, binding)
 
-    if (expr.format != Literal(TimestampFormatter.defaultPattern)) {
-      withInfo(expr, "Datetime pattern format is unsupported")
-      None
-    } else if (secExpr.isDefined && formatExpr.isDefined) {
-      val timestampExpr =
-        scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): _*)
-      val optExpr = scalarFunctionExprToProto("to_char", Seq(timestampExpr, 
formatExpr): _*)
-      optExprWithInfo(optExpr, expr, expr.sec, expr.format)
-    } else {
-      withInfo(expr, expr.sec, expr.format)
-      None
+    expr.format match {
+      case Literal(fmt, _) if fmt != null && fmt.toString != 
TimestampFormatter.defaultPattern =>
+        withInfo(expr, "Datetime pattern format is unsupported")
+        None
+      case _ if secExpr.isDefined && formatExpr.isDefined =>
+        val timestampExpr =
+          scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): 
_*)
+        val optExpr = scalarFunctionExprToProto("to_char", Seq(timestampExpr, 
formatExpr): _*)
+        optExprWithInfo(optExpr, expr, expr.sec, expr.format)

Review Comment:
   thank you . this code is no longer reachable given the compatibility checks 
`getSupportLevel`



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