You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Chaoyu Tang <ct...@gmail.com> on 2014/09/06 07:57:16 UTC

Review Request 25412: HIVE-1363: SHOW TABLE EXTENDED LIKE command does not strip single/double quotes

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25412/
-----------------------------------------------------------

Review request for hive.


Repository: hive-git


Description
-------

'SHOW TABLE EXTENDED [IN|FROM database_name] LIKE identifier_with_wildcards' command does not strip single/double quotes around identifier_with_wildcards and returns empty results. It is because the identifier_with_wildcards in this query is a token type of HiveParser.StringLiteral and the method unescapeIdentifier used in BaseSemanticAnalyzer.getUnescapedName could not strip its quotes. The quotes become parts of the tablename regexp and therefore no matched tables are returned for this pattern.
For the token of HiveParser.StringLiteral from this kind of query, we can use unescapeSQLString to strip their quotes. The change in this patch is to use unescapeSQLString to remove the quotes around identifier_with_wildcards.


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java b5b2b609b2bda7180219ae95fbbe42ad07ed0d97 
  ql/src/test/queries/clientpositive/show_tables.q f33325dbb9e410a828b3bb8b1e5bdce234025d3b 
  ql/src/test/results/clientpositive/show_tables.q.out 0d4aa5713e22bec90c8dd68ab08de4f8ff9d6eb8 

Diff: https://reviews.apache.org/r/25412/diff/


Testing
-------

1. Manual test: with the changes, all following cases are working just like the other command "SHOW TABLES..."
SHOW TABLE EXTENDED IN test_db LIKE 'ba*';
SHOW TABLE EXTENDED IN test_db LIKE "ba*";
SHOW TABLE EXTENDED IN test_db LIKE `ba*`;
2. six related unit tests are added to show_tables.q and they work as expected
3. submit this patch for pre-commit test to see if the changes will cause other regression.


Thanks,

Chaoyu Tang


Re: Review Request 25412: HIVE-1363: SHOW TABLE EXTENDED LIKE command does not strip single/double quotes

Posted by Chaoyu Tang <ct...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25412/
-----------------------------------------------------------

(Updated Sept. 6, 2014, 5:15 p.m.)


Review request for hive.


Changes
-------

Change based on XueFu's comments. Thanks Xuefu for the review.


Repository: hive-git


Description
-------

'SHOW TABLE EXTENDED [IN|FROM database_name] LIKE identifier_with_wildcards' command does not strip single/double quotes around identifier_with_wildcards and returns empty results. It is because the identifier_with_wildcards in this query is a token type of HiveParser.StringLiteral and the method unescapeIdentifier used in BaseSemanticAnalyzer.getUnescapedName could not strip its quotes. The quotes become parts of the tablename regexp and therefore no matched tables are returned for this pattern.
For the token of HiveParser.StringLiteral from this kind of query, we can use unescapeSQLString to strip their quotes. The change in this patch is to use unescapeSQLString to remove the quotes around identifier_with_wildcards.


Diffs (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java b5b2b609b2bda7180219ae95fbbe42ad07ed0d97 
  ql/src/test/queries/clientpositive/show_tables.q f33325dbb9e410a828b3bb8b1e5bdce234025d3b 
  ql/src/test/results/clientpositive/show_tables.q.out 0d4aa5713e22bec90c8dd68ab08de4f8ff9d6eb8 

Diff: https://reviews.apache.org/r/25412/diff/


Testing
-------

1. Manual test: with the changes, all following cases are working just like the other command "SHOW TABLES..."
SHOW TABLE EXTENDED IN test_db LIKE 'ba*';
SHOW TABLE EXTENDED IN test_db LIKE "ba*";
SHOW TABLE EXTENDED IN test_db LIKE `ba*`;
2. six related unit tests are added to show_tables.q and they work as expected
3. submit this patch for pre-commit test to see if the changes will cause other regression.


Thanks,

Chaoyu Tang


Re: Review Request 25412: HIVE-1363: SHOW TABLE EXTENDED LIKE command does not strip single/double quotes

Posted by Xuefu Zhang <xz...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25412/#review52540
-----------------------------------------------------------



ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
<https://reviews.apache.org/r/25412/#comment91339>

    Minor nit: could we have a local var for tableOrColumnNode.getToken().getType(), as this is long and used twice in the same method?


- Xuefu Zhang


On Sept. 6, 2014, 5:57 a.m., Chaoyu Tang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/25412/
> -----------------------------------------------------------
> 
> (Updated Sept. 6, 2014, 5:57 a.m.)
> 
> 
> Review request for hive.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> 'SHOW TABLE EXTENDED [IN|FROM database_name] LIKE identifier_with_wildcards' command does not strip single/double quotes around identifier_with_wildcards and returns empty results. It is because the identifier_with_wildcards in this query is a token type of HiveParser.StringLiteral and the method unescapeIdentifier used in BaseSemanticAnalyzer.getUnescapedName could not strip its quotes. The quotes become parts of the tablename regexp and therefore no matched tables are returned for this pattern.
> For the token of HiveParser.StringLiteral from this kind of query, we can use unescapeSQLString to strip their quotes. The change in this patch is to use unescapeSQLString to remove the quotes around identifier_with_wildcards.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java b5b2b609b2bda7180219ae95fbbe42ad07ed0d97 
>   ql/src/test/queries/clientpositive/show_tables.q f33325dbb9e410a828b3bb8b1e5bdce234025d3b 
>   ql/src/test/results/clientpositive/show_tables.q.out 0d4aa5713e22bec90c8dd68ab08de4f8ff9d6eb8 
> 
> Diff: https://reviews.apache.org/r/25412/diff/
> 
> 
> Testing
> -------
> 
> 1. Manual test: with the changes, all following cases are working just like the other command "SHOW TABLES..."
> SHOW TABLE EXTENDED IN test_db LIKE 'ba*';
> SHOW TABLE EXTENDED IN test_db LIKE "ba*";
> SHOW TABLE EXTENDED IN test_db LIKE `ba*`;
> 2. six related unit tests are added to show_tables.q and they work as expected
> 3. submit this patch for pre-commit test to see if the changes will cause other regression.
> 
> 
> Thanks,
> 
> Chaoyu Tang
> 
>