Skip to content

Commit

Permalink
[GLUTEN-7755] [CH] translate support args with unequal length
Browse files Browse the repository at this point in the history
  • Loading branch information
shuai-xu committed Dec 9, 2024
1 parent 15f4cde commit 0a01099
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 regexp_test
""".stripMargin,
true,
{ _ => }
)
}
}

}

0 comments on commit 0a01099

Please sign in to comment.