danielhumanmod commented on code in PR #2831:
URL: https://github.com/apache/datafusion-comet/pull/2831#discussion_r2583897542
##########
spark/src/main/scala/org/apache/comet/serde/strings.scala:
##########
@@ -286,3 +286,83 @@ trait CommonStringExprs {
}
}
}
+
+object CometRegExpExtract extends CometExpressionSerde[RegExpExtract] {
+ override def getSupportLevel(expr: RegExpExtract): SupportLevel = {
+ // Check if the pattern is compatible with Spark or allow incompatible
patterns
+ expr.regexp match {
+ case Literal(pattern, DataTypes.StringType) =>
+ if (!RegExp.isSupportedPattern(pattern.toString) &&
+ !CometConf.COMET_REGEXP_ALLOW_INCOMPATIBLE.get()) {
+ withInfo(
+ expr,
+ s"Regexp pattern $pattern is not compatible with Spark. " +
+ s"Set ${CometConf.COMET_REGEXP_ALLOW_INCOMPATIBLE.key}=true " +
+ "to allow it anyway.")
+ return Incompatible()
+ }
+ case _ =>
+ return Unsupported(Some("Only literal regexp patterns are supported"))
+ }
+
+ // Check if idx is a literal
+ expr.idx match {
+ case Literal(_, DataTypes.IntegerType) =>
+ Compatible()
+ case _ =>
+ Unsupported(Some("Only literal group index is supported"))
Review Comment:
Good catch, will add support for these data types
--
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]