Baymine opened a new pull request, #66181:
URL: https://github.com/apache/doris/pull/66181

   ### What problem does this PR solve?
   
   Issue Number: close #66179
   
   Related PR: N/A
   
   Problem Summary:
   
   `element_at(split_by_string(s, d), n)` builds the whole split array (a 
PODArray allocation and a memcpy per part, per row) and then picks a single 
entry. This rewrites it to `split_part(s, d, n)`, which short-circuits as soon 
as it locates the n-th delimiter, eliminating the intermediate array and the 
trailing-parts work.
   
   The rewrite is semantics-preserving. The two forms differ only when the 
string yields no n-th part: `element_at` returns NULL while `split_part` can 
return `''`. To neutralize this, the rule only rewrites the ROOT of a top-level 
filter conjunct (where NULL and false both drop the row) and is guarded to:
   - EqualTo / InPredicate with a NON-EMPTY string-literal RHS (or an IN-list 
of non-empty string literals), so a comparison against `''` yields false, not 
true;
   - a NON-EMPTY string-literal separator (an empty/column separator diverges);
   - a NON-NEGATIVE int-literal index (negative back-counting uses rfind and 
can land on a different boundary for self-overlapping multi-char separators).
   
   It deliberately does NOT recurse into NOT / OR / CASE, where NULL and `''` 
are no longer interchangeable.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - [x] Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Please explain why:
   
   - [ ] Behavior changed:
   
   - [ ] Does this need documentation?
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


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

Reply via email to