mbutrovich commented on code in PR #2075:
URL: https://github.com/apache/datafusion-comet/pull/2075#discussion_r2258276337


##########
spark/src/test/scala/org/apache/comet/CometFuzzTestSuite.scala:
##########
@@ -273,7 +272,6 @@ class CometFuzzTestSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
 
   test("decode") {
     // https://github.com/apache/datafusion-comet/issues/1942

Review Comment:
   I think you can remove this comment line too.



##########
spark/src/main/spark-4.0/org/apache/comet/shims/CometExprShim.scala:
##########
@@ -34,6 +42,42 @@ trait CometExprShim {
 
     protected def evalMode(c: Cast): CometEvalMode.Value =
         CometEvalModeUtil.fromSparkEvalMode(c.evalMode)
+
+    def versionSpecificExprToProtoInternal(
+        expr: Expression,
+        inputs: Seq[Attribute],
+        binding: Boolean): Option[Expr] = {
+      expr match {
+        case s: StaticInvoke
+            if s.staticObject == classOf[StringDecode] &&
+              s.dataType.isInstanceOf[StringType] &&
+              s.functionName == "decode" &&
+              s.arguments.size == 4 &&
+              s.inputTypes == Seq(
+                  BinaryType,
+                  StringTypeWithCollation(supportsTrimCollation = true),
+                  BooleanType,
+                  BooleanType) =>
+          val Seq(bin, charset, _, _) = s.arguments
+          charset match {
+            case Literal(str, DataTypes.StringType)
+                if str.toString.toLowerCase(Locale.ROOT) == "utf-8" =>
+              // decode(col, 'utf-8') can be treated as a cast with "try" eval 
mode that puts nulls

Review Comment:
   This is duplicated in QueryPlanSerde. If we need both, can we leave comments 
here and there that we should update both if the logic changes (i.e., adding 
support for "ascii" instead of just "utf-8"). It would probably break in CI on 
Spark 4.0, but just in case.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to