[fix](function) Bound parse_url's HOST, PORT and USERINFO at the authority - #68370
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
…ority
### What problem does this PR solve?
Issue Number: none
Problem Summary: parse_url searches for the ':' that separates the port, and
the '@' that separates the userinfo, across the whole url rather than across
its authority component, so a ':' or an '@' in the path, the query or the
fragment is read as a separator. parse_url('http://example.com/a:b', 'HOST')
returns example.com/a and the PORT of the same url returns b. Both the BE
UrlParser and the FE StringArithmetic constant-folding mirror have it. HOST,
PORT and USERINFO now go through the same authority step AUTHORITY used, which
is extended to stop at '?' and '#' as well.
### Release note
parse_url no longer treats a ':' or an '@' outside the authority as a port or
userinfo separator, so HOST, PORT, USERINFO and AUTHORITY agree with
java.net.URL for urls whose path, query or fragment contains one of those
characters.
### Check List (For Author)
- Test: Unit Test
- Behavior changed: Yes, as described in the release note
- Does this need documentation: No
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
arpitjain099
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
September 22, 2026 05:11
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
/review |
Contributor
There was a problem hiding this comment.
Static review result: ready from the code-review perspective; no blocking findings.
Critical checkpoint conclusions:
- Goal and correctness: the patch bounds AUTHORITY, HOST, PORT, and USERINFO parsing at the earliest slash, question mark, or hash. The BE runtime path and FE constant-folding path implement the same boundary and preserve matching empty-string versus NULL behavior.
- Scope and clarity: the change is focused on a shared BE helper plus the mirrored FE helper and their direct tests; unrelated URL parts and function registration are unchanged.
- Parallel paths and compatibility: both FE folding and BE vectorized execution were updated. The behavior change is limited to separators outside the authority; there is no FE-BE protocol, symbol, serialization, storage-format, or rolling-upgrade concern.
- Conditions and error handling: all delimiter absence and ordering combinations were checked statically. BE negative-length StringRef slicing intentionally means the remaining full view, and returned views are copied by the caller before input lifetime ends. Invalid-part handling is unchanged.
- Concurrency and lifecycle: this is stateless scalar parsing. It adds no threads, locks, mutable shared state, cross-TU dependency, or special resource lifecycle.
- Configuration, persistence, transactions, and data writes: none are involved. No observability addition is needed for this local deterministic helper.
- Performance: the added work is a bounded set of linear single-byte scans over one URL, allocation-free in BE and planner-time only in FE; no material regression was found.
- Tests: mirrored BE and FE unit cases cover path, query, and fragment false separators, real userinfo and port values, all four affected parts, and NULL behavior. The author explicitly reports standalone checks rather than full suites. This automated review was static-only, so no build or test result was independently produced.
- User focus: no additional focus was supplied; the full five-file change and relevant call chains were reviewed.
All normal and risk-focused review passes converged with no new valuable findings. No inline comments were submitted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: none
Problem Summary:
parse_urlhunts for the ':' that separates the port, and the '@' that separates the userinfo, across the whole url rather than across its authority. Anything in the path, the query or the fragment gets picked up as a separator:A ':' inside a path segment is perfectly legal (RFC 3986 pchar), and Hive answers these through
java.net.URL, which gives hostexample.com, no port and no userinfo for all four.Both of our implementations do it, since the FE constant folding path in
StringArithmetic.parseUrlRawmirrors the BEUrlParserclosely.AUTHORITYwas the one already close to right, because it cut at the first '/', so HOST, PORT and USERINFO now go through that same step and it is extended to stop at '?' and '#' as well.Release note
parse_urlno longer treats a ':' or an '@' outside the authority as a port or userinfo separator, soHOST,PORT,USERINFOandAUTHORITYnow agree withjava.net.URLon urls whose path, query or fragment contains one of those characters.Check List (For Author)
be/test/exprs/function/function_url_test.cppand toStringArithmeticTest.java, one per affected part.url_parser.cppcompiled and driven standalone, and the FEparseUrl*methods extracted and run under a JDK. Both now agree withjava.net.URLon every case in the new tests. CI is the real check here, and I would rather say that than imply I ran the suites.nereids_function_p0andfold_constant_string_arithmatichave no ':' or '@' outside the authority, so they should be unaffected.