Repository navigation
branch-4.2: [fix](function) Skip hidden elements in NULL subarrays when flattening #69321 - #69534
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
#69321) ### What problem does this PR solve? Issue Number: N/A Problem Summary: `array_flatten(array(if(id = 1, NULL, a), [9]))` could return `[101, 102, 9]` even though the input is visibly `[NULL, [9]]`. Root cause: flattening composed offsets without checking subarray null maps. Expressions such as `IF` can retain nonempty payloads beneath NULL subarrays. Filter those hidden ranges at each nesting level before composing offsets, preserve NULL scalar elements, and share the final leaf column through COW instead of cloning it. ### Release note Fix `array_flatten` returning hidden elements from NULL subarrays. ### Check List (For Author) - Test: - [x] Regression test: generated `array_flatten.out` with `-forceGenOut`, then reran `array_flatten` successfully. - [x] Manual test: rebuilt BE; verified the original reproducer, deeper nesting, materialized INSERT SELECT, empty arrays, outer NULLs, and NULL scalar elements. - [ ] Unit Test: added `FunctionArrayFlattenTest` coverage; execution is pending because the initial ASAN UT build was interrupted before completion. - Validation above used base `e0050c41211372e813107f13366d03fe45c005d6`. The patch was subsequently carried to master `f6359ae80659c43cc847223278ff9ec808b7ee19`; all four changed files were identical between these bases before applying the patch. No rebuild was performed after this move. - Formatting, build hygiene, and `git diff --check` passed. - Behavior changed: - [x] Yes. NULL subarrays contribute no elements to the flattened result. - Does this need documentation? - [x] No. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
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.
Cherry-picked from #69321