-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[opt](function) Enhance the handling of a single struct-type argument in the EXPLODE function #57050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
run buildall |
|
run buildall |
TPC-DS: Total hot run time: 189309 ms |
ClickBench: Total hot run time: 30.4 s |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-DS: Total hot run time: 190296 ms |
ClickBench: Total hot run time: 30.16 s |
… in the EXPLODE function
|
run buildall |
ClickBench: Total hot run time: 30.15 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
… in the EXPLODE function (#57050) ### What problem does this PR solve? Since the EXPLODE function supports multiple arguments, its return value is defined as a STRUCT type. Even when it has only a single argument, it still returns a STRUCT. Consider the following example: ```sql SELECT * FROM (SELECT 1) t1 LATERAL VIEW explode(array(struct('a', 1), struct('b', 2))) t2 AS c1, c2; ``` ```text +------+------------------------+ | 1 | c1 | +------+------------------------+ | 1 | {"col1":"a", "col2":1} | | 1 | {"col1":"b", "col2":2} | +------+------------------------+ ``` In this SQL statement, the return value of the EXPLODE function is a nested STRUCT (that is, the child column inside the struct is struct too). As a result, the final output extracts the child column from the outer struct, but those child columns themselves are not correctly assigned to c1 and c2. With this PR, the result will be like this: ```text +------+------+------+ | 1 | c1 | c2 | +------+------+------+ | 1 | a | 1 | | 1 | b | 2 | +------+------+------+ ``` Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…ype argument in the EXPLODE function (apache#57050) Cherry-picked from apache#57050 Co-authored-by: Jerry Hu <hushenggang@selectdb.com>
… in the EXPLODE function apache#57050 (apache#5641) pick apache#57050
What problem does this PR solve?
Since the EXPLODE function supports multiple arguments, its return value is defined as a STRUCT type. Even when it has only a single argument, it still returns a STRUCT.
Consider the following example:
In this SQL statement, the return value of the EXPLODE function is a nested STRUCT (that is, the child column inside the struct is struct too).
As a result, the final output extracts the child column from the outer struct, but those child columns themselves are not correctly assigned to c1 and c2.
With this PR, the result will be like this:
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)