Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
{ _ => }
)
}
}

}
Loading