[fix](function) Fix BE crash in trim when input column is ColumnConst - #67736
Open
LLLLLL302311 wants to merge 1 commit into
Open
[fix](function) Fix BE crash in trim when input column is ColumnConst#67736LLLLLL302311 wants to merge 1 commit into
LLLLLL302311 wants to merge 1 commit into
Conversation
Trim1Impl/Trim2Impl directly assert_cast<const ColumnString*> on the input column. When the input reaching the implementation is a ColumnConst (which can happen on pushdown / materialization paths that invoke the function implementation directly, bypassing the const-unwrapping in default_implementation_for_constant_arguments), the assert_cast hits the wrong type and aborts the BE (undefined behavior in release builds). Unpack the const first via unpack_if_const, and use check_and_get_column, which returns nullptr on a type mismatch and falls through to the existing RuntimeError branch instead of crashing. This matches the defensive pattern used elsewhere in the codebase and does not change behavior on the normal column path. Add a regression test that builds a ColumnConst block and calls execute_impl directly, since the normal execute() entry unwraps all-constant arguments before reaching the implementation and cannot reproduce the crash. Signed-off-by: lijinghan.1029 <lijinghan.1029@jd.com> Conflicts: be/test/exprs/function/function_string_test.cpp
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
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?
Problem Summary:
Trim1Impl/Trim2Impldirectlyassert_cast<const ColumnString*>the input column. When the column reaching the implementation is aColumnConst— which can happen on pushdown / materialization paths that invoke the function implementation directly, bypassing the const-unwrapping done bydefault_implementation_for_constant_arguments— theassert_casthits the wrong type and aborts the BE (undefined behavior in release builds).The fix unpacks the const first via
unpack_if_const, then usescheck_and_get_column, which returnsnullptron a type mismatch and falls through to the existingRuntimeErrorbranch instead of crashing. This matches the defensive pattern used elsewhere in the codebase and does not change behavior on the normal column path.Release note
Fix BE crash in
trim/ltrim/rtrimwhen the input column is aColumnConst.Check List (For Author)