This is an automated email from the ASF dual-hosted git repository.

changchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new f0490424e4 [GLUTEN-7755] [CH] translate support args with unequal 
length (#7768)
f0490424e4 is described below

commit f0490424e42c64be9126ecfe4b5eb685e8329a0c
Author: shuai.xu <[email protected]>
AuthorDate: Thu Dec 12 14:59:50 2024 +0800

    [GLUTEN-7755] [CH] translate support args with unequal length (#7768)
    
    * [GLUTEN-7755] [CH] translate support args with unequal length
    
    * fix test
---
 .../apache/gluten/expression/CHExpressionTransformer.scala |  6 ------
 .../compatibility/GlutenClickhouseFunctionSuite.scala      | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git 
a/backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala
 
b/backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala
index ab9fdd29f6..762160110f 100644
--- 
a/backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala
+++ 
b/backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressionTransformer.scala
@@ -125,12 +125,6 @@ case class CHStringTranslateTransformer(
       throw new GlutenNotSupportException(s"$original not supported yet.")
     }
 
-    val matchingLiteral = matchingNode.asInstanceOf[StringLiteralNode].getValue
-    val replaceLiteral = replaceNode.asInstanceOf[StringLiteralNode].getValue
-    if (matchingLiteral.length() != replaceLiteral.length()) {
-      throw new GlutenNotSupportException(s"$original not supported yet.")
-    }
-
     super.doTransform(args)
   }
 }
diff --git 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/compatibility/GlutenClickhouseFunctionSuite.scala
 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/compatibility/GlutenClickhouseFunctionSuite.scala
index 2437ffd035..8f2658ef8f 100644
--- 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/compatibility/GlutenClickhouseFunctionSuite.scala
+++ 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/compatibility/GlutenClickhouseFunctionSuite.scala
@@ -415,4 +415,18 @@ class GlutenClickhouseFunctionSuite extends 
GlutenClickHouseTPCHAbstractSuite {
     }
   }
 
+  test("GLUTEN-7755: translate support args with unequal length") {
+    withTable("test_7755") {
+      sql("create table if not exists test_7755 (id string) using parquet")
+      sql("insert into test_7755 values('aAbBcC')")
+      compareResultsAgainstVanillaSpark(
+        """
+          |select translate(id, 'abc', '12') from test_7755
+        """.stripMargin,
+        true,
+        { _ => }
+      )
+    }
+  }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to