Myx778 commented on code in PR #4105:
URL: https://github.com/apache/datafusion-comet/pull/4105#discussion_r3152242545


##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -166,6 +166,7 @@ object QueryPlanSerde extends Logging with CometExprShim 
with CometTypeShim {
       classOf[GetJsonObject] -> CometGetJsonObject,
       classOf[InitCap] -> CometInitCap,
       classOf[Length] -> CometLength,
+      classOf[Levenshtein] -> CometScalarFunction("levenshtein"),

Review Comment:
   Done! Added `CometLevenshtein` serde object in `strings.scala` with 
`getSupportLevel` that checks for non-default collation:
   
   ```scala
   object CometLevenshtein extends 
CometScalarFunction[Levenshtein]("levenshtein") {
     override def getSupportLevel(expr: Levenshtein): SupportLevel = {
       expr.children.headOption match {
         case Some(child) if 
QueryPlanSerde.isStringCollationType(child.dataType) =>
           Unsupported(Some("Levenshtein with non-default collation is not 
supported"))
         case _ => Compatible()
       }
     }
   }
   ```
   
   This uses the existing `isStringCollationType` from `CometTypeShim` (which 
checks `collationId != StringType.collationId` on Spark 4, no-op on Spark 3.x). 
Non-default collations will fall back to Spark's implementation.
   
   Updated `QueryPlanSerde.scala` mapping from generic 
`CometScalarFunction("levenshtein")` to `CometLevenshtein`.
   
   Commit: 7f37fd85



-- 
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]

Reply via email to