ryanmeowy commented on PR #13145:
URL: https://github.com/apache/seatunnel/pull/13145#issuecomment-6656999022

   Following up on my own review of the fix for Issue 1, one more thing worth 
flagging explicitly rather than leaving in a code comment.
   
   The previous head of this PR broke `RLIKE`/`REGEXP` outright; that is fixed. 
But comparing the parent commit against the fixed head over a 671-case sweep 
(LIKE / NOT LIKE / RLIKE / REGEXP / NOT RLIKE × 11 values × 16-9 patterns) 
turned up a second, narrower behaviour change inside the `RLIKE`/`REGEXP` 
family:
   
   | predicate (row `Alice`) | parent commit | this PR |
   |---|---|---|
   | `name RLIKE 'A.*'` | true | true |
   | `name RLIKE '%A.*'` | **true** | **false** |
   | `name RLIKE 'A.%'` | **true** | **false** |
   | `name RLIKE '_lice'` | **true** | **false** |
   | `name REGEXP '.*ice%'` | **true** | **false** |
   
   Reason: the old code fed *every* `LikeExpression` through the LIKE boundary 
rewriting before compiling, so for `RLIKE`/`REGEXP` a pattern starting or 
ending with `%`/`_` was also rewritten (`%` → `.*`, `_` → `.`) and then 
compiled. Now the regex is used verbatim.
   
   I believe used-verbatim is the correct semantics — `%` and `_` are not regex 
metacharacters, so a pattern like `RLIKE '%A.*'` was being "helpfully" mangled 
before. But it is a user-visible change in the same family as the bug being 
fixed, so it is now stated in the description instead of only in a comment.
   
   For completeness, on the same 671-case sweep, all 72 LIKE / NOT LIKE 
differences move toward the SQL truth value (interior wildcards, `'%%%%'`, 
`'1.5'` no longer matching `125`, `'a(b%'` no longer throwing), and the newline 
cases are the ones already discussed in Issue 2. The 27 `RLIKE`/`REGEXP` 
differences are the boundary-rewrite ones above.
   
   Two other things I checked while reviewing:
   
   - **Existing E2E is unaffected.** `sql_transform/criteria_filter.conf` uses 
six LIKE predicates (`'%Din_'`, `'Wan_%'`, `'%Yu%'`, `'%LeBron%'`, `'Wan_%'`, 
`'%Lian_'`); I evaluated them over nine candidate name values on both 
implementations — all 54 cells identical.
   - **Invalid `RLIKE` patterns still fail the same way.** `'a(b'`, `'['`, 
`'a**'` throw `PatternSyntaxException` exactly as on the parent commit, so no 
new exception path was introduced.
   
   Local state: `ZetaSQLFilterTest` 13, 
`+DateTimeFunctionsTest+SQLDateTimeFunctionsTest+SQLTransformTest` 77 passed, 
`spotless:check` green on JDK 17, and the independent DP-matcher fuzz 
cross-check is still 0 mismatches over 61,609 random pairs.
   
   Head is now 850647c. The last commit is comment-only (it corrects the 
Javadoc claim), so the behaviour you review is the same as ef6705e.
   


-- 
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]

Reply via email to