nimesh1601 commented on code in PR #10567:
URL: 
https://github.com/apache/incubator-gluten/pull/10567#discussion_r2308986733


##########
gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -279,12 +279,23 @@ object ExpressionConverter extends SQLConfHelper with 
Logging {
       case t: ToUnixTimestamp =>
         // The failOnError depends on the config for ANSI. ANSI is not 
supported currently.
         // And timeZoneId is passed to backend config.
+        // For timestamp and date inputs, the format parameter is ignored as 
per Spark behavior.
+        val timeExpTransformer =
+          replaceWithExpressionTransformer0(t.timeExp, attributeSeq, 
expressionsMap)
+        val children = t.timeExp.dataType match {
+          case _: TimestampType | _: DateType =>
+            // For timestamp/date input, format is ignored - only pass timeExp
+            Seq(timeExpTransformer)
+          case _ =>
+            // For string input, format is used - pass both timeExp and format
+            Seq(
+              timeExpTransformer,
+              replaceWithExpressionTransformer0(t.format, attributeSeq, 
expressionsMap)
+            )
+        }
         GenericExpressionTransformer(
           substraitExprName,
-          Seq(
-            replaceWithExpressionTransformer0(t.timeExp, attributeSeq, 
expressionsMap),
-            replaceWithExpressionTransformer0(t.format, attributeSeq, 
expressionsMap)
-          ),
+          children,

Review Comment:
   Thanks @rui-mo for the suggestion. Made changes accordingly



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