peter-toth commented on code in PR #2075:
URL: https://github.com/apache/datafusion-comet/pull/2075#discussion_r2259627159
##########
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:
Oh yes. Fixed in
https://github.com/apache/datafusion-comet/pull/2075/commits/b830922a1e07f96823fd660df29cf7be0ef0042f.
##########
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:
Yeah, the proto encoding logic is the same. We can extrat it to small
helper:
https://github.com/apache/datafusion-comet/pull/2075/commits/b830922a1e07f96823fd660df29cf7be0ef0042f
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]