SAMARTHJAISWAL opened a new pull request, #7736: URL: https://github.com/apache/datafusion-comet/pull/7736
## Which issue does this PR close? Closes #7711. ## Rationale for this change Spark compiles the pattern of `regexp_extract` and `regexp_extract_all` only on a row whose subject is non-null. When every subject row is null it returns null and never looks at the pattern. The native implementation compiled the pattern before looking at the subject, so an invalid pattern (or one that only Rust regex rejects, such as a lookahead) raised an error on input where Spark returns null. ## What changes are included in this PR? `parse_args` in `regexp_extract_common.rs` now returns `ParsedArgs::NullResult` before compiling the pattern when the subject is a `Utf8`/`LargeUtf8` array whose rows are all null, or a null string scalar. Both functions share this path. A subject with at least one non-null row still reports the invalid pattern, and other subject types are still reported as unsupported. ## How are these changes tested? - Unit tests in `regexp_extract.rs` and `regexp_extract_all.rs`: all-null `Utf8` and `LargeUtf8` arrays and a null scalar return null with an invalid pattern; an array with one non-null row still errors. - SQL file tests in `regexp_extract_enabled.sql` and `regexp_extract_all_enabled.sql`: an all-null table with an invalid pattern and with a lookahead pattern, and a `WHERE s IS NULL` filter over the existing table, all checked against Spark with `expect_native`. The new tests fail without the fix. -- 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]
