Skip to content

Commit

Permalink
[GLUTEN-7755] [CH] translate support args with unequal length (apache…
Browse files Browse the repository at this point in the history
…#7768)

* [GLUTEN-7755] [CH] translate support args with unequal length

* fix test
  • Loading branch information
shuai-xu authored and yikf committed Dec 13, 2024
1 parent 1d7616a commit 55b423e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{ _ => }
)
}
}

}

0 comments on commit 55b423e

Please sign in to comment.