-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-24012][SQL] Union of map and other compatible column #21100
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a422a7f
[SPARK-24012][SQL] Union of map and other compatible column
liutang123 cb883d9
[SPARK-24012][SQL] change map<type1, nullable type2> and map<type1, n…
liutang123 19b5c6a
SPARK-24012 add same type checke for map and array in TypeCoercion#fi…
liutang123 0845739
SPARK-24012 code style fix
liutang123 670824f
SPARK-24012 code style fix
liutang123 8cb240f
SPARK-24012 add UT for array
liutang123 4b1ce36
SPARK-24012 remove UT from SQLQuerySuite
liutang123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,17 @@ FROM (SELECT col AS col | |
SELECT col | ||
FROM p3) T1) T2; | ||
|
||
-- SPARK-24012 Union of map and other compatible columns. | ||
SELECT map(1, 2), 'str' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we also add a test for array? |
||
UNION ALL | ||
SELECT map(1, 2, 3, NULL), 1; | ||
|
||
-- SPARK-24012 Union of array and other compatible columns. | ||
SELECT array(1, 2), 'str' | ||
UNION ALL | ||
SELECT array(1, 2, 3, NULL), 1; | ||
|
||
|
||
-- Clean-up | ||
DROP VIEW IF EXISTS t1; | ||
DROP VIEW IF EXISTS t2; | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I think we should do the same thing in
findWiderTypeForTwo
to cover some corner cases such as decimal or string promotion within keys and values .. ? and seems #21100 (comment) suggested the same thing ..?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something we should figure out: why
findWiderTypeForTwo
only take care of array type? seems all complex types should be handled there, especially if it follows Hive's behavior.Anyway it's orthogonal to
findTightestCommonType
, they are used for different operators.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I was just wondering while reading it. However, doesn't that mean we don't do type widening for nested types in the same way? I was thinking we should do the same type widening for nested types too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I was thinking we should do that in both places in
findTightestCommonType
andfindWiderTypeForTwo
. Otherwise, the nested types in struct, map or array won't do, for example, decimal or string promotion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's orthogonal. Yup, I was just wondering. I am okay to leave this out of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I misread your comment. Sorry. I was talking about the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to look into
findTightestCommonType
. Currently we are just very conservative and only allow nullability change for complex types infindTightestCommonType
. We need to take a look at other systems and see what they do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with that given past discussions - I didn't mean we should change something now .. but was just wondering.