This is an automated email from the ASF dual-hosted git repository.

HappenLee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e3b9673ef9 [improvement](constant folding) Reuse parsed URL query 
bounds (#68177)
4e3b9673ef9 is described below

commit 4e3b9673ef93514910d4e73837fd6ca4e3d7d2f3
Author: HappenLee <[email protected]>
AuthorDate: Sun Sep 20 11:43:12 2026 +0800

    [improvement](constant folding) Reuse parsed URL query bounds (#68177)
    
    Related PR: #68011
    
    Problem Summary: The FE constant-folding implementation of
    `parse_url(..., 'QUERY')` already locates the first `#` in the URL, but
    then creates a suffix string and scans that suffix for `#` again. This
    repeats work and, when a fragment exists, temporarily copies the
    fragment even though its end position is already known. Reuse the
    existing query and fragment boundaries to extract the result directly.
    The returned values and NULL/empty-string behavior are unchanged.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test: No need to test (small allocation and scan reduction; no
    behavior change)
    - Behavior changed: No
    - Does this need documentation: No
---
 .../trees/expressions/functions/executable/StringArithmetic.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
index c58ab97ede4..c2679c1f862 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
@@ -1044,8 +1044,8 @@ public class StringArithmetic {
             // fragment and the url has no query component.
             return null;
         }
-        String queryStart = protocolEnd.substring(startPos + 1);
-        return substringEnd(queryStart, queryStart.indexOf('#'));
+        return protocolEnd.substring(startPos + 1,
+                fragmentPos >= 0 ? fragmentPos : protocolEnd.length());
     }
 
     private static String parseUrlRef(String protocolEnd) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to