-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29610: Add support for SQL wildcards (% and _) in SHOW COLUMNS aligning with other SHOW commands #6481
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
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. nit: A more relevant name for this? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| CREATE DATABASE IF NOT EXISTS col_test_db; | ||
| USE col_test_db; | ||
|
|
||
| CREATE TABLE wildcard_table ( | ||
| id_primary INT, | ||
| id_secondary INT, | ||
| name_first STRING, | ||
| name_last STRING | ||
| ); | ||
|
Contributor
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. Can we add columns here to tests case insensitivity? Since we are using |
||
|
|
||
|
|
||
| SHOW TABLES LIKE 'wild%'; | ||
| SHOW TABLES LIKE 'wild*'; | ||
| SHOW TABLES LIKE 'none|wildcard_table'; | ||
|
Contributor
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. These seem out of scope as this PR is fixing SHOW COLUMNS ... LIKE. |
||
|
|
||
| SHOW COLUMNS FROM wildcard_table LIKE 'id%'; | ||
| SHOW COLUMNS FROM wildcard_table LIKE 'name_%'; | ||
|
Contributor
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. Here we are really testing |
||
| SHOW COLUMNS FROM wildcard_table LIKE 'id*'; | ||
| SHOW COLUMNS FROM wildcard_table LIKE 'id_primary|name_first'; | ||
|
|
||
| DROP DATABASE col_test_db CASCADE; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| PREHOOK: query: CREATE DATABASE IF NOT EXISTS col_test_db | ||
| PREHOOK: type: CREATEDATABASE | ||
| PREHOOK: Output: database:col_test_db | ||
| POSTHOOK: query: CREATE DATABASE IF NOT EXISTS col_test_db | ||
| POSTHOOK: type: CREATEDATABASE | ||
| POSTHOOK: Output: database:col_test_db | ||
| PREHOOK: query: USE col_test_db | ||
| PREHOOK: type: SWITCHDATABASE | ||
| PREHOOK: Input: database:col_test_db | ||
| POSTHOOK: query: USE col_test_db | ||
| POSTHOOK: type: SWITCHDATABASE | ||
| POSTHOOK: Input: database:col_test_db | ||
| PREHOOK: query: CREATE TABLE wildcard_table ( | ||
| id_primary INT, | ||
| id_secondary INT, | ||
| name_first STRING, | ||
| name_last STRING | ||
| ) | ||
| PREHOOK: type: CREATETABLE | ||
| PREHOOK: Output: col_test_db@wildcard_table | ||
| PREHOOK: Output: database:col_test_db | ||
| POSTHOOK: query: CREATE TABLE wildcard_table ( | ||
| id_primary INT, | ||
| id_secondary INT, | ||
| name_first STRING, | ||
| name_last STRING | ||
| ) | ||
| POSTHOOK: type: CREATETABLE | ||
| POSTHOOK: Output: col_test_db@wildcard_table | ||
| POSTHOOK: Output: database:col_test_db | ||
| PREHOOK: query: SHOW TABLES LIKE 'wild%' | ||
| PREHOOK: type: SHOWTABLES | ||
| PREHOOK: Input: database:col_test_db | ||
| POSTHOOK: query: SHOW TABLES LIKE 'wild%' | ||
| POSTHOOK: type: SHOWTABLES | ||
| POSTHOOK: Input: database:col_test_db | ||
| wildcard_table | ||
| PREHOOK: query: SHOW TABLES LIKE 'wild*' | ||
| PREHOOK: type: SHOWTABLES | ||
| PREHOOK: Input: database:col_test_db | ||
| POSTHOOK: query: SHOW TABLES LIKE 'wild*' | ||
| POSTHOOK: type: SHOWTABLES | ||
| POSTHOOK: Input: database:col_test_db | ||
| wildcard_table | ||
| PREHOOK: query: SHOW TABLES LIKE 'none|wildcard_table' | ||
| PREHOOK: type: SHOWTABLES | ||
| PREHOOK: Input: database:col_test_db | ||
| POSTHOOK: query: SHOW TABLES LIKE 'none|wildcard_table' | ||
| POSTHOOK: type: SHOWTABLES | ||
| POSTHOOK: Input: database:col_test_db | ||
| wildcard_table | ||
| PREHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id%' | ||
| PREHOOK: type: SHOWCOLUMNS | ||
| PREHOOK: Input: col_test_db@wildcard_table | ||
| POSTHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id%' | ||
| POSTHOOK: type: SHOWCOLUMNS | ||
| POSTHOOK: Input: col_test_db@wildcard_table | ||
| id_primary | ||
| id_secondary | ||
| PREHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'name_%' | ||
| PREHOOK: type: SHOWCOLUMNS | ||
| PREHOOK: Input: col_test_db@wildcard_table | ||
| POSTHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'name_%' | ||
| POSTHOOK: type: SHOWCOLUMNS | ||
| POSTHOOK: Input: col_test_db@wildcard_table | ||
| name_first | ||
| name_last | ||
| PREHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id*' | ||
| PREHOOK: type: SHOWCOLUMNS | ||
| PREHOOK: Input: col_test_db@wildcard_table | ||
| POSTHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id*' | ||
| POSTHOOK: type: SHOWCOLUMNS | ||
| POSTHOOK: Input: col_test_db@wildcard_table | ||
| id_primary | ||
| id_secondary | ||
| PREHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id_primary|name_first' | ||
| PREHOOK: type: SHOWCOLUMNS | ||
| PREHOOK: Input: col_test_db@wildcard_table | ||
| POSTHOOK: query: SHOW COLUMNS FROM wildcard_table LIKE 'id_primary|name_first' | ||
| POSTHOOK: type: SHOWCOLUMNS | ||
| POSTHOOK: Input: col_test_db@wildcard_table | ||
| id_primary | ||
| name_first | ||
| PREHOOK: query: DROP DATABASE col_test_db CASCADE | ||
| PREHOOK: type: DROPDATABASE | ||
| PREHOOK: Input: database:col_test_db | ||
| PREHOOK: Output: col_test_db@wildcard_table | ||
| PREHOOK: Output: database:col_test_db | ||
| POSTHOOK: query: DROP DATABASE col_test_db CASCADE | ||
| POSTHOOK: type: DROPDATABASE | ||
| POSTHOOK: Input: database:col_test_db | ||
| POSTHOOK: Output: col_test_db@wildcard_table | ||
| POSTHOOK: Output: database:col_test_db |
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.
Maybe combine these together?
Also add a small comment explaining the condition