-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-27495: NPE when trying to transform using clause to on clause #4478
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d49eb14
HIVE-27495: NPE when trying to transform using clause to on clause
soumyakanti3578 42cfdde
resolve review comments
soumyakanti3578 73f861d
fix join_using_clause_wrong_column.q.out
soumyakanti3578 a057492
clean up code and use explain cbo
soumyakanti3578 3ddf203
add a test for joins without using table aliases
soumyakanti3578 97979a5
Add negative test for ambiguous table
soumyakanti3578 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 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
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
7 changes: 7 additions & 0 deletions
7
ql/src/test/queries/clientnegative/join_using_clause_ambiguous_table.q
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| create table test( | ||
| a int | ||
| ); | ||
|
|
||
| select * from test | ||
| join test using(a) | ||
| join test using(a); |
8 changes: 8 additions & 0 deletions
8
ql/src/test/queries/clientnegative/join_using_clause_wrong_column.q
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| create table test( | ||
| a int | ||
| ); | ||
|
|
||
| select * from test t1 | ||
| join test t2 using(a) | ||
| join test t3 using(b); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
|
|
||
| create table test ( | ||
| a int | ||
| ); | ||
|
|
||
| insert into test values (1); | ||
|
|
||
| create table test1 ( | ||
| a int, | ||
| b int | ||
| ); | ||
|
|
||
| insert into test1 values (1, 2); | ||
|
|
||
| create table test2 ( | ||
| a int, | ||
| b int, | ||
| c int | ||
| ); | ||
|
|
||
| insert into test2 values (1, 2, 3); | ||
|
|
||
| -- self join with 1 column | ||
| select * from test t1 | ||
| join test t2 using(a) | ||
| join test t3 using(a); | ||
|
|
||
| explain cbo select * from test t1 | ||
| join test t2 using(a) | ||
| join test t3 using(a); | ||
|
|
||
| -- self join with multiple columns | ||
| select * from test1 t1 | ||
| join test1 t2 using(a) | ||
| join test1 t3 using(b); | ||
|
|
||
| explain cbo select * from test1 t1 | ||
| join test1 t2 using(a) | ||
| join test1 t3 using(b); | ||
|
|
||
| -- joins with multiple tables and columns | ||
| select * from test1 t1 | ||
| join test t2 using(a) | ||
| join test2 t3 using(b); | ||
|
|
||
| explain cbo select * from test1 t1 | ||
| join test t2 using(a) | ||
| join test2 t3 using(b); | ||
|
|
||
| select * from test t1 | ||
| join test1 t2 using(a) | ||
| join test2 t3 using(b) | ||
| join test2 t4 using(c); | ||
|
|
||
| explain cbo select * from test t1 | ||
| join test1 t2 using(a) | ||
| join test2 t3 using(b) | ||
| join test2 t4 using(c); | ||
|
|
||
| select * from test1 t1 | ||
| join test2 t2 using(a, b) | ||
| join test2 t3 using(c, b) | ||
| join test t4 using(a); | ||
|
|
||
| explain cbo select * from test1 t1 | ||
| join test2 t2 using(a, b) | ||
| join test2 t3 using(c, b) | ||
| join test t4 using(a); | ||
|
|
||
kasakrisz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -- joins without table alias | ||
| select * from test1 | ||
| join test using(a) | ||
| join test2 using(b); | ||
|
|
||
| explain cbo select * from test1 | ||
| join test using(a) | ||
| join test2 using(b); | ||
13 changes: 13 additions & 0 deletions
13
ql/src/test/results/clientnegative/join_using_clause_ambiguous_table.q.out
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| PREHOOK: query: create table test( | ||
| a int | ||
| ) | ||
| PREHOOK: type: CREATETABLE | ||
| PREHOOK: Output: database:default | ||
| PREHOOK: Output: default@test | ||
| POSTHOOK: query: create table test( | ||
| a int | ||
| ) | ||
| POSTHOOK: type: CREATETABLE | ||
| POSTHOOK: Output: database:default | ||
| POSTHOOK: Output: default@test | ||
| FAILED: SemanticException [Error 10008]: Line 4:5 Ambiguous table alias 'test' |
13 changes: 13 additions & 0 deletions
13
ql/src/test/results/clientnegative/join_using_clause_wrong_column.q.out
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| PREHOOK: query: create table test( | ||
| a int | ||
| ) | ||
| PREHOOK: type: CREATETABLE | ||
| PREHOOK: Output: database:default | ||
| PREHOOK: Output: default@test | ||
| POSTHOOK: query: create table test( | ||
| a int | ||
| ) | ||
| POSTHOOK: type: CREATETABLE | ||
| POSTHOOK: Output: database:default | ||
| POSTHOOK: Output: default@test | ||
| FAILED: SemanticException column 'b' not present in any of these tables: [t1, t2] |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.