[Feature](lambda) Support some map lambda functions - #67284
Draft
morrySnow wants to merge 5 commits into
Draft
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#66968 Problem Summary: Map offsets use 64-bit positions while IColumn::Selector stores 32-bit indexes. map_filter and the filtered-entry map constructor could therefore truncate a position at 2^32 and silently copy the wrong key and value. Validate the nested entry count before building a selector and return INVALID_ARGUMENT when an index cannot be represented. Add an O(1)-memory boundary unit test for the overflow case. ### Release note Reject map operations whose nested positions exceed the selector range instead of returning corrupted data. ### Check List (For Author) - Test: Unit Test (FunctionMapTest.* under ASAN) - Behavior changed: Yes (oversized selector inputs now return INVALID_ARGUMENT) - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Issue Number: None Related PR: apache#66968 Problem Summary: Higher-order function analysis selected map handling and array comparator behavior with hardcoded function-name checks. Move lambda parameter binding contracts into builtin function registration and use the resolved function builder metadata to analyze array and map lambdas through one flow. None - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.nereids.rules.analysis.FunctionRegistryTest,org.apache.doris.nereids.trees.expressions.functions.scalar.MapLambdaFunctionsTest,org.apache.doris.nereids.rules.analysis.CheckExpressionLegalityTest,org.apache.doris.nereids.trees.expressions.functions.scalar.ArrayFirstLastTest - mvn checkstyle:check -pl fe-core - Behavior changed: No - Does this need documentation: No
Contributor
TPC-H: Total hot run time: 17096 ms |
Contributor
TPC-DS: Total hot run time: 83883 ms |
Contributor
ClickBench: Total hot run time: 15 s |
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?
Related PR: #67045, #67047
Doc: apache/doris-website#4085
Problem Summary:
This PR adds MAP lambda support under the Nereids planner.
Supported higher-order functions:
map_filter((k, v) -> predicate, map)map_exists((k, v) -> predicate, map)map_all((k, v) -> predicate, map)map_apply((k, v) -> struct(new_key, new_value), map)transform_keys((k, v) -> new_key, map)transform_values((k, v) -> new_value, map)Example:
Implementation
Use
map_entries(m)to expand the map parameter and reuse the originalarray lambdafor execution.Internal helper function
This PR adds two internal Map construction functions used by the rewritten expressions:
transform_valuemap_from_entries. Used bymap_filter