soumyakanti3578 commented on code in PR #6481:
URL: https://github.com/apache/hive/pull/6481#discussion_r3270282059
##########
ql/src/test/queries/clientpositive/show_columns_inconsistency.q:
##########
@@ -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
+);
+
+
+SHOW TABLES LIKE 'wild%';
+SHOW TABLES LIKE 'wild*';
+SHOW TABLES LIKE 'none|wildcard_table';
Review Comment:
These seem out of scope as this PR is fixing SHOW COLUMNS ... LIKE.
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java:
##########
@@ -85,6 +85,8 @@ public static String likePatternToRegExp(String likePattern,
boolean literalize,
sb.append(".");
} else if (n == '%') {
sb.append(greedyMatch ? ".*" : ".*?");
+ } else if (n == '*' && !literalize) {
+ sb.append(greedyMatch ? ".*" : ".*?");
Review Comment:
Maybe combine these together?
Also add a small comment explaining the condition
##########
ql/src/test/queries/clientpositive/show_columns_inconsistency.q:
##########
@@ -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
+);
Review Comment:
Can we add columns here to tests case insensitivity? Since we are using
`Pattern.CASE_INSENSITIVE`
##########
ql/src/test/queries/clientpositive/show_columns_inconsistency.q:
##########
@@ -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
+);
+
+
+SHOW TABLES LIKE 'wild%';
+SHOW TABLES LIKE 'wild*';
+SHOW TABLES LIKE 'none|wildcard_table';
+
+SHOW COLUMNS FROM wildcard_table LIKE 'id%';
+SHOW COLUMNS FROM wildcard_table LIKE 'name_%';
Review 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.
##########
ql/src/test/queries/clientpositive/show_columns_inconsistency.q:
##########
Review Comment:
nit: A more relevant name for this? `show_columns_like.q` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]