HIVE-29610: Add support for SQL wildcards (% and _) in SHOW COLUMNS aligning with other SHOW commands#6481
HIVE-29610: Add support for SQL wildcards (% and _) in SHOW COLUMNS aligning with other SHOW commands#6481Aggarwal-Raghav wants to merge 1 commit into
Conversation
…ligning with other SHOW commands
|
After HIVE-23359 the behaviour in Hive3 vs Hive4.0.1 for regex pattern was changed i.e. breaking change until HIVE-28292 was merged. The following overloaded method where In |
|
CC @wecharyu @deniskuzZ , requesting for review and feedback on the approach. |
|
|
UT failure is un-related. will re-run post review comments |
soumyakanti3578
left a comment
There was a problem hiding this comment.
Overall this looks quite good, but needs cleaning up in a few places and also needs more tests.
| } else if (n == '%') { | ||
| sb.append(greedyMatch ? ".*" : ".*?"); | ||
| } else if (n == '*' && !literalize) { | ||
| sb.append(greedyMatch ? ".*" : ".*?"); |
There was a problem hiding this comment.
Maybe combine these together?
Also add a small comment explaining the condition
| SHOW TABLES LIKE 'wild%'; | ||
| SHOW TABLES LIKE 'wild*'; | ||
| SHOW TABLES LIKE 'none|wildcard_table'; |
There was a problem hiding this comment.
These seem out of scope as this PR is fixing SHOW COLUMNS ... LIKE.
There was a problem hiding this comment.
nit: A more relevant name for this? show_columns_like.q ?
| id_secondary INT, | ||
| name_first STRING, | ||
| name_last STRING | ||
| ); |
There was a problem hiding this comment.
Can we add columns here to tests case insensitivity? Since we are using Pattern.CASE_INSENSITIVE
| SHOW TABLES LIKE 'none|wildcard_table'; | ||
|
|
||
| SHOW COLUMNS FROM wildcard_table LIKE 'id%'; | ||
| SHOW COLUMNS FROM wildcard_table LIKE 'name_%'; |
There was a problem hiding this comment.
Here we are really testing %, and not _. Can we add more tests for the single char wildcard?
Also add more tests for empty results, like abc%, id__, for example.



What changes were proposed in this pull request?
Check HIVE-29610
Why are the changes needed?
ShowColumnsOperationdoesn't make use ofUDFLike#likePatternToRegExp()and only resolve*regex pattern and not the%which was introduced in HIVE-23359.Does this PR introduce any user-facing change?
Yes, show columns will start supporint query like
SHOW COLUMNS FROM tbl LIKE 'name_%';and will be backward compatible to support*.How was this patch tested?
Running the following UT and cluster testing
Before

After
