danielhumanmod commented on code in PR #2831:
URL: https://github.com/apache/datafusion-comet/pull/2831#discussion_r2650416405
##########
spark/src/test/scala/org/apache/comet/CometStringExpressionSuite.scala:
##########
@@ -391,4 +391,315 @@ class CometStringExpressionSuite extends CometTestBase {
}
}
+ test("regexp_extract basic") {
+ withSQLConf(CometConf.COMET_REGEXP_ALLOW_INCOMPATIBLE.key -> "true") {
+ val data = Seq(
+ ("100-200", 1),
+ ("300-400", 1),
+ (null, 1), // NULL input
+ ("no-match", 1), // no match → should return ""
+ ("abc123def456", 1),
+ ("", 1) // empty string
+ )
+
+ withParquetTable(data, "tbl") {
+ // Test basic extraction: group 0 (full match)
+ checkSparkAnswerAndOperator("SELECT regexp_extract(_1,
'(\\d+)-(\\d+)', 0) FROM tbl")
+ // Test group 1
+ checkSparkAnswerAndOperator("SELECT regexp_extract(_1,
'(\\d+)-(\\d+)', 1) FROM tbl")
Review Comment:
Thanks for catching this issue, already fixed it in latest commit!
--
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]