You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2009/12/04 23:32:00 UTC

svn commit: r887396 - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/test/queries/clientpositive/ ql/src/test/results/clientpositive/

Author: zshao
Date: Fri Dec  4 22:31:59 2009
New Revision: 887396

URL: http://svn.apache.org/viewvc?rev=887396&view=rev
Log:
HIVE-962 "show functions" should work with unquoted string. (Paul Yang via zshao)

Added:
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/show_describe_func_quotes.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=887396&r1=887395&r2=887396&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Fri Dec  4 22:31:59 2009
@@ -302,6 +302,9 @@
     HIVE-966 Hive should emit log messages in 24-hour format
     (Zheng Shao via namit)
 
+    HIVE-962 "show functions" should work with unquoted string.
+    (Paul Yang via zshao)
+
 Release 0.4.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java?rev=887396&r1=887395&r2=887396&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java Fri Dec  4 22:31:59 2009
@@ -373,7 +373,7 @@
   throws SemanticException {
     showFunctionsDesc showFuncsDesc;
     if (ast.getChildCount() == 1) {
-      String funcNames = unescapeSQLString(ast.getChild(0).getText());
+      String funcNames = stripQuotes(ast.getChild(0).getText());
       showFuncsDesc = new showFunctionsDesc(ctx.getResFile(), funcNames);
     }
     else {
@@ -395,10 +395,10 @@
     boolean isExtended;
 
     if(ast.getChildCount() == 1) {
-      funcName = ast.getChild(0).getText();
+      funcName = stripQuotes(ast.getChild(0).getText());
       isExtended = false;
     } else if(ast.getChildCount() == 2) {
-      funcName = ast.getChild(0).getText();
+      funcName = stripQuotes(ast.getChild(0).getText());
       isExtended = true;
     } else {
       throw new SemanticException("Unexpected Tokens at DESCRIBE FUNCTION");

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g?rev=887396&r1=887395&r2=887396&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Fri Dec  4 22:31:59 2009
@@ -1296,6 +1296,7 @@
 descFuncNames
     : 
       sysFuncNames
+    | StringLiteral
     | Identifier 
     ;
 

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/show_describe_func_quotes.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/show_describe_func_quotes.q?rev=887396&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/show_describe_func_quotes.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/show_describe_func_quotes.q Fri Dec  4 22:31:59 2009
@@ -0,0 +1,7 @@
+SHOW FUNCTIONS 'concat';
+
+SHOW FUNCTIONS concat;
+
+DESCRIBE FUNCTION 'concat';
+
+DESCRIBE FUNCTION concat;

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out?rev=887396&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out Fri Dec  4 22:31:59 2009
@@ -0,0 +1,20 @@
+PREHOOK: query: SHOW FUNCTIONS 'concat'
+PREHOOK: type: SHOWFUNCTIONS
+POSTHOOK: query: SHOW FUNCTIONS 'concat'
+POSTHOOK: type: SHOWFUNCTIONS
+concat
+PREHOOK: query: SHOW FUNCTIONS concat
+PREHOOK: type: SHOWFUNCTIONS
+POSTHOOK: query: SHOW FUNCTIONS concat
+POSTHOOK: type: SHOWFUNCTIONS
+concat
+PREHOOK: query: DESCRIBE FUNCTION 'concat'
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION 'concat'
+POSTHOOK: type: DESCFUNCTION
+concat(str1, str2, ... strN) - returns the concatenation of str1, str2, ... strN
+PREHOOK: query: DESCRIBE FUNCTION concat
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION concat
+POSTHOOK: type: DESCFUNCTION
+concat(str1, str2, ... strN) - returns the concatenation of str1, str2, ... strN