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


##########
spark/src/main/scala/org/apache/comet/serde/unixtime.scala:
##########
@@ -29,12 +29,27 @@ import 
org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, optExprWithIn
 // https://github.com/apache/datafusion/issues/16594
 object CometFromUnixTime extends CometExpressionSerde[FromUnixTime] {
 
+  override def getUnsupportedReasons(): Seq[String] = Seq(
+    "Only supports the default datetime format pattern `yyyy-MM-dd HH:mm:ss`")
+
   override def getIncompatibleReasons(): Seq[String] = Seq(
-    "Only supports the default datetime format pattern `yyyy-MM-dd HH:mm:ss`." 
+
-      " DataFusion's valid timestamp range differs from Spark" +
+    "DataFusion's valid timestamp range differs from Spark" +
       " (https://github.com/apache/datafusion/issues/16594)")
 
-  override def getSupportLevel(expr: FromUnixTime): SupportLevel = 
Incompatible(None)
+  override def getSupportLevel(expr: FromUnixTime): SupportLevel = {
+    expr.format match {
+      case Literal(fmt, _) =>
+        val formatStr = fmt.toString
+        val defaultPattern = TimestampFormatter.defaultPattern
+        if (formatStr == defaultPattern) {
+          Incompatible(None)
+        } else {
+          Unsupported(Some(s"Datetime pattern format: $formatStr is 
unsupported"))
+        }
+      case _ =>
+        Unsupported(Some("Datetime pattern format is unsupported"))

Review Comment:
   thank you for the idea ! I updated the message to reflect that only 
non-literal formats are not supported



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