You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/04/06 18:40:36 UTC
(datafusion) branch gh-readonly-queue/main/pr-21413-206ac6b950e709373a39e74ebb33ed0c95edce9e created (now 8a2d75818e)
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a change to branch gh-readonly-queue/main/pr-21413-206ac6b950e709373a39e74ebb33ed0c95edce9e
in repository https://gitbox.apache.org/repos/asf/datafusion.git
at 8a2d75818e Minor: add tests for regexp_replace and capture groups (#21413)
This branch includes the following new commits:
new 8a2d75818e Minor: add tests for regexp_replace and capture groups (#21413)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
(datafusion) 01/01: Minor: add tests for regexp_replace and capture groups (#21413)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch gh-readonly-queue/main/pr-21413-206ac6b950e709373a39e74ebb33ed0c95edce9e
in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit 8a2d75818e6274691e32246392742182250f177e
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Mon Apr 6 14:40:12 2026 -0400
Minor: add tests for regexp_replace and capture groups (#21413)
## Which issue does this PR close?
- related to https://github.com/apache/datafusion/pull/21379
## Rationale for this change
As suggested by @adriangb
https://github.com/apache/datafusion/pull/21379#issuecomment-4193504419
Let's add some additional test coverage as we work to optimize
regexp_replace
## What changes are included in this PR?
Add some tests
## Are these changes tested?
yes
## Are there any user-facing changes?
No
---
.../test_files/regexp/regexp_replace.slt | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt b/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt
index a16801adce..a2eccfce5f 100644
--- a/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt
+++ b/datafusion/sqllogictest/test_files/regexp/regexp_replace.slt
@@ -127,3 +127,30 @@ from (values ('a'), ('b')) as tbl(col);
----
NULL NULL NULL
NULL NULL NULL
+
+# If the overall pattern matches but capture group 1 does not participate,
+# regexp_replace(..., '\1') should substitute the empty string, not keep
+# the original input.
+query B
+SELECT regexp_replace('bzzz', '^(a)?b.*$', '\1') = '';
+----
+true
+
+# Stripping trailing .*$ must not change match semantics for inputs with
+# newlines when the original pattern does not use the 's' flag.
+query B
+SELECT regexp_replace(concat('http://x/', chr(10), 'rest'), '^https?://([^/]+)/.*$', '\1')
+ = concat('http://x/', chr(10), 'rest');
+----
+true
+
+# Inline multiline mode still allows only the matched prefix to be replaced.
+# The remainder of the string must be preserved.
+query B
+SELECT regexp_replace(
+ concat('http://x/path', chr(10), 'rest'),
+ '^(?m)https?://([^/]+)/.*$',
+ '\1'
+ ) = concat('x', chr(10), 'rest');
+----
+true
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org