linrrzqqq opened a new pull request, #68146:
URL: https://github.com/apache/doris/pull/68146
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
An empty regexp produces a zero-width match, so the expected result is 1.
The constant pattern was recognized as a substring pattern and routed to the
long-buffer substring optimization. However, this path treated an empty needle
as not found.
```sql
DROP TABLE IF EXISTS tmp_b8_c01;
CREATE TABLE tmp_b8_c01 (
id INT,
s STRING,
p STRING
)
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES("replication_num" = "1");
INSERT INTO tmp_b8_c01 VALUES (1, 'abc', '');
SELECT
regexp('abc', '') AS const_empty,
regexp(s, p) AS column_empty
FROM tmp_b8_c01
WHERE id = 1;
-- before:
+-------------+--------------+
| const_empty | column_empty |
+-------------+--------------+
| 0 | 1 |
+-------------+--------------+
-- now:
+-------------+--------------+
| const_empty | column_empty |
+-------------+--------------+
| 1 | 1 |
+-------------+--------------+
```
### What is changed?
- Handle an empty constant substring pattern as matching every non-null
input.
- Move the long-buffer substring implementation into `constant_substring_fn`.
- Remove the separate execute_substring implementation and its special
dispatch logic.
- Preserve row-boundary checks to prevent matches across adjacent
ColumnString rows.
--
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]