[fix](function) Preserve invalid URL decoded bytes - #67841
Merged
morrySnow merged 1 commit intoSep 14, 2026
Merged
Conversation
Problem: URL_DECODE returned different bytes for a constant expression and the runtime path when percent escapes decoded to invalid UTF-8. Cause: The FE executable function used Java URLDecoder, which silently replaced malformed UTF-8 with replacement characters before constructing a string literal. The BE decoder preserves the decoded bytes. Solution: Reconstruct and strictly validate the decoded UTF-8 byte stream before FE evaluation. If it is invalid, leave the function expression unfolded so BE retains its byte-level behavior. Keep folding valid input and preserve malformed-percent handling. Tests: Add unit coverage for invalid UTF-8, valid multibyte text, and a legitimate replacement character. Add regression coverage comparing constant and runtime decoding across invalid byte sequences.
morrySnow
requested review from
924060929,
englefly and
starocean999
as code owners
September 11, 2026 05:23
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 17045 ms |
Contributor
TPC-DS: Total hot run time: 83330 ms |
Contributor
ClickBench: Total hot run time: 14.83 s |
starocean999
approved these changes
Sep 12, 2026
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.
Problem
URL_DECODEreturned different bytes depending on whether the expression was folded by FE. For example:The folded path returned
EFBFBDEFBFBD, while evaluation in BE returnedC0AF.Cause
The FE executable function delegates to Java
URLDecoder, whose UTF-8 conversion silently replaces malformed byte sequences with U+FFFD. The BE URL decoder has byte-level semantics and preserves each decoded%HHbyte. A Java string literal therefore cannot represent the BE result losslessly when the decoded bytes are invalid UTF-8.Fix
Tests
%80,%C0%AF,%E0%80%80,%ED%A0%80,%FF, valid multibyte text, and encoded U+FFFD.StringArithmeticTest: 7 tests passed.