Author: hashutosh
Date: Wed Feb 12 23:58:41 2014
New Revision: 1567811

URL: http://svn.apache.org/r1567811
Log:
HIVE-6167 : Allow user-defined functions to be qualified with database name 
(Jason Dere via Ashutosh Chauhan)

Added:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java
    hive/trunk/ql/src/test/queries/clientnegative/udf_invalid.q
    hive/trunk/ql/src/test/queries/clientnegative/udf_qualified_name.q
    hive/trunk/ql/src/test/results/clientnegative/udf_invalid.q.out
    hive/trunk/ql/src/test/results/clientnegative/udf_qualified_name.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
    
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FunctionSemanticAnalyzer.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
    
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MacroSemanticAnalyzer.java

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java?rev=1567811&r1=1567810&r2=1567811&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 
Wed Feb 12 23:58:41 2014
@@ -44,6 +44,7 @@ import org.apache.hadoop.hive.ql.metadat
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc;
+import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.ql.udf.SettableUDF;
 import org.apache.hadoop.hive.ql.udf.UDAFPercentile;
 import org.apache.hadoop.hive.ql.udf.UDFAcos;
@@ -167,7 +168,6 @@ public final class FunctionRegistry {
 
   static Map<String, WindowFunctionInfo> windowFunctions = 
Collections.synchronizedMap(new LinkedHashMap<String, WindowFunctionInfo>());
 
-
   static {
     registerGenericUDF("concat", GenericUDFConcat.class);
     registerUDF("substr", UDFSubstr.class, false);
@@ -419,8 +419,8 @@ public final class FunctionRegistry {
     registerGenericUDTF("stack", GenericUDTFStack.class);
 
     //PTF declarations
-    registerGenericUDF(true, LEAD_FUNC_NAME, GenericUDFLead.class);
-    registerGenericUDF(true, LAG_FUNC_NAME, GenericUDFLag.class);
+    registerGenericUDF(LEAD_FUNC_NAME, GenericUDFLead.class);
+    registerGenericUDF(LAG_FUNC_NAME, GenericUDFLag.class);
 
     registerWindowFunction("row_number", new GenericUDAFRowNumber());
     registerWindowFunction("rank", new GenericUDAFRank());
@@ -519,8 +519,32 @@ public final class FunctionRegistry {
     }
   }
 
+  private static <T> T getQualifiedFunctionInfo(Map<String, T> mFunctions, 
String functionName) {
+    T functionInfo =  mFunctions.get(functionName);
+    // Eventually this would check metastore for registered functions.
+    return functionInfo;
+  }
+
+  private static <T> T getFunctionInfo(Map<String, T> mFunctions, String 
functionName) {
+    functionName = functionName.toLowerCase();
+    T functionInfo = null;
+    if (FunctionUtils.isQualifiedFunctionName(functionName)) {
+      functionInfo = getQualifiedFunctionInfo(mFunctions, functionName);
+    } else {
+      // First try without qualifiers - would resolve builtin/temp functions.
+      // Otherwise try qualifying with current db name.
+      functionInfo =  mFunctions.get(functionName);
+      if (functionInfo == null && 
!FunctionUtils.isQualifiedFunctionName(functionName)) {
+        String qualifiedName = FunctionUtils.qualifyFunctionName(functionName,
+            SessionState.get().getCurrentDatabase());
+        functionInfo = getQualifiedFunctionInfo(mFunctions, qualifiedName);
+      }
+    }
+    return functionInfo;
+  }
+
   public static FunctionInfo getFunctionInfo(String functionName) {
-    return mFunctions.get(functionName.toLowerCase());
+    return getFunctionInfo(mFunctions, functionName);
   }
 
   /**
@@ -1049,7 +1073,7 @@ public final class FunctionRegistry {
     if (LOG.isDebugEnabled()) {
       LOG.debug("Looking up GenericUDAF: " + functionName);
     }
-    FunctionInfo finfo = mFunctions.get(functionName.toLowerCase());
+    FunctionInfo finfo = getFunctionInfo(functionName);
     if (finfo == null) {
       return null;
     }
@@ -1695,9 +1719,8 @@ public final class FunctionRegistry {
     }
   }
 
-  public static WindowFunctionInfo getWindowFunctionInfo(String name)
-  {
-    return windowFunctions.get(name.toLowerCase());
+  public static WindowFunctionInfo getWindowFunctionInfo(String functionName) {
+    return getFunctionInfo(windowFunctions, functionName);
   }
 
   /**
@@ -1710,7 +1733,7 @@ public final class FunctionRegistry {
    */
   public static boolean impliesOrder(String functionName) {
 
-    FunctionInfo info = mFunctions.get(functionName.toLowerCase());
+    FunctionInfo info = getFunctionInfo(functionName);
     if (info != null) {
       if (info.isGenericUDF()) {
         UDFType type = 
info.getGenericUDF().getClass().getAnnotation(UDFType.class);
@@ -1719,7 +1742,7 @@ public final class FunctionRegistry {
         }
       }
     }
-    WindowFunctionInfo windowInfo = 
windowFunctions.get(functionName.toLowerCase());
+    WindowFunctionInfo windowInfo = getWindowFunctionInfo(functionName);
     if (windowInfo != null) {
       return windowInfo.isImpliesOrder();
     }
@@ -1735,13 +1758,13 @@ public final class FunctionRegistry {
 
   public static boolean isTableFunction(String name)
   {
-    FunctionInfo tFInfo = mFunctions.get(name.toLowerCase());
+    FunctionInfo tFInfo = getFunctionInfo(name);
     return tFInfo != null && !tFInfo.isInternalTableFunction() && 
tFInfo.isTableFunction();
   }
 
   public static TableFunctionResolver getTableFunctionResolver(String name)
   {
-    FunctionInfo tfInfo = mFunctions.get(name.toLowerCase());
+    FunctionInfo tfInfo = getFunctionInfo(name);
     if(tfInfo.isTableFunction()) {
       return (TableFunctionResolver) 
ReflectionUtils.newInstance(tfInfo.getFunctionClass(), null);
     }
@@ -1774,7 +1797,7 @@ public final class FunctionRegistry {
    *         confirms a ranking function, false otherwise
    */
   public static boolean isRankingFunction(String name){
-    FunctionInfo info = mFunctions.get(name.toLowerCase());
+    FunctionInfo info = getFunctionInfo(name);
     GenericUDAFResolver res = info.getGenericUDAFResolver();
     if (res != null){
       WindowFunctionDescription desc = 
res.getClass().getAnnotation(WindowFunctionDescription.class);

Added: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java?rev=1567811&view=auto
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java 
(added)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java 
Wed Feb 12 23:58:41 2014
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.exec;
+
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+
+public class FunctionUtils {
+
+  public static boolean isQualifiedFunctionName(String functionName) {
+    return functionName.indexOf('.') >= 0;
+  }
+
+  public static String qualifyFunctionName(String functionName, String dbName) 
{
+    if (isQualifiedFunctionName(functionName)) {
+      return functionName;
+    }
+    return dbName + "." + functionName;
+  }
+
+  /**
+   * Splits a qualified function name into an array containing the database 
name and function name.
+   * If the name is not qualified, the database name is null.
+   * If there is more than one '.', an exception will be thrown.
+   * @param functionName Function name, which may or may not be qualified
+   * @return
+   */
+  public static String[] splitQualifiedFunctionName(String functionName) 
throws HiveException {
+    String[] names = functionName.split("\\.");
+    if (names.length == 1) {
+      String[] retval = { null, functionName };
+      return retval;
+    } else if (names.length > 2) {
+      throw new HiveException("Function name does not have correct format: " + 
functionName);
+    }
+    return names;
+  }
+
+}

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FunctionSemanticAnalyzer.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FunctionSemanticAnalyzer.java?rev=1567811&r1=1567810&r2=1567811&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FunctionSemanticAnalyzer.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FunctionSemanticAnalyzer.java
 Wed Feb 12 23:58:41 2014
@@ -23,6 +23,7 @@ import org.apache.hadoop.hive.conf.HiveC
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hadoop.hive.ql.exec.FunctionRegistry;
+import org.apache.hadoop.hive.ql.exec.FunctionUtils;
 import org.apache.hadoop.hive.ql.exec.TaskFactory;
 import org.apache.hadoop.hive.ql.plan.CreateFunctionDesc;
 import org.apache.hadoop.hive.ql.plan.DropFunctionDesc;
@@ -55,6 +56,12 @@ public class FunctionSemanticAnalyzer ex
   private void analyzeCreateFunction(ASTNode ast) throws SemanticException {
     String functionName = ast.getChild(0).getText();
     String className = unescapeSQLString(ast.getChild(1).getText());
+
+    // Temp functions are not allowed to have qualified names.
+    if (FunctionUtils.isQualifiedFunctionName(functionName)) {
+      throw new SemanticException("Temporary function cannot be created with a 
qualified name.");
+    }
+
     CreateFunctionDesc desc = new CreateFunctionDesc(functionName, className);
     rootTasks.add(TaskFactory.get(new FunctionWork(desc), conf));
   }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g?rev=1567811&r1=1567810&r2=1567811&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g 
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g Wed Feb 
12 23:58:41 2014
@@ -1280,7 +1280,7 @@ showStatement
     | KW_SHOW KW_TABLES ((KW_FROM|KW_IN) db_name=identifier)? (KW_LIKE 
showStmtIdentifier|showStmtIdentifier)?  -> ^(TOK_SHOWTABLES (TOK_FROM 
$db_name)? showStmtIdentifier?)
     | KW_SHOW KW_COLUMNS (KW_FROM|KW_IN) tabname=tableName ((KW_FROM|KW_IN) 
db_name=identifier)? 
     -> ^(TOK_SHOWCOLUMNS $db_name? $tabname)
-    | KW_SHOW KW_FUNCTIONS showStmtIdentifier?  -> ^(TOK_SHOWFUNCTIONS 
showStmtIdentifier?)
+    | KW_SHOW KW_FUNCTIONS showFunctionIdentifier?  -> ^(TOK_SHOWFUNCTIONS 
showFunctionIdentifier?)
     | KW_SHOW KW_PARTITIONS tabName=tableName partitionSpec? -> 
^(TOK_SHOWPARTITIONS $tabName partitionSpec?) 
     | KW_SHOW KW_CREATE KW_TABLE tabName=tableName -> ^(TOK_SHOW_CREATETABLE 
$tabName)
     | KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM|KW_IN) db_name=identifier)? 
KW_LIKE showStmtIdentifier partitionSpec?
@@ -1496,15 +1496,15 @@ metastoreCheck
 createFunctionStatement
 @init { pushMsg("create function statement", state); }
 @after { popMsg(state); }
-    : KW_CREATE KW_TEMPORARY KW_FUNCTION identifier KW_AS StringLiteral
-    -> ^(TOK_CREATEFUNCTION identifier StringLiteral)
+    : KW_CREATE KW_TEMPORARY KW_FUNCTION functionIdentifier KW_AS StringLiteral
+    -> ^(TOK_CREATEFUNCTION functionIdentifier StringLiteral)
     ;
 
 dropFunctionStatement
 @init { pushMsg("drop temporary function statement", state); }
 @after { popMsg(state); }
-    : KW_DROP KW_TEMPORARY KW_FUNCTION ifExists? identifier
-    -> ^(TOK_DROPFUNCTION identifier ifExists?)
+    : KW_DROP KW_TEMPORARY KW_FUNCTION ifExists? functionIdentifier
+    -> ^(TOK_DROPFUNCTION functionIdentifier ifExists?)
     ;
 
 createMacroStatement
@@ -1555,6 +1555,13 @@ dropViewStatement
     : KW_DROP KW_VIEW ifExists? viewName -> ^(TOK_DROPVIEW viewName ifExists?)
     ;
 
+showFunctionIdentifier
+@init { pushMsg("identifier for show function statement", state); }
+@after { popMsg(state); }
+    : functionIdentifier
+    | StringLiteral
+    ;
+
 showStmtIdentifier
 @init { pushMsg("identifier for show statement", state); }
 @after { popMsg(state); }

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g?rev=1567811&r1=1567810&r2=1567811&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g 
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g 
Wed Feb 12 23:58:41 2014
@@ -183,7 +183,7 @@ functionName
 @init { gParent.pushMsg("function name", state); }
 @after { gParent.popMsg(state); }
     : // Keyword IF is also a function name
-    KW_IF | KW_ARRAY | KW_MAP | KW_STRUCT | KW_UNIONTYPE | identifier
+    KW_IF | KW_ARRAY | KW_MAP | KW_STRUCT | KW_UNIONTYPE | functionIdentifier
     ;
 
 castExpression
@@ -268,10 +268,10 @@ atomExpression
     KW_NULL -> TOK_NULL
     | dateLiteral
     | constant
-    | function
     | castExpression
     | caseExpression
     | whenExpression
+    | (functionName LPAREN) => function
     | tableOrColumn
     | LPAREN! expression RPAREN!
     ;
@@ -524,7 +524,7 @@ descFuncNames
     :
       sysFuncNames
     | StringLiteral
-    | identifier
+    | functionIdentifier
     ;
 
 identifier
@@ -533,6 +533,15 @@ identifier
     | nonReserved -> Identifier[$nonReserved.text]
     ;
 
+functionIdentifier
+@init { gParent.pushMsg("function identifier", state); }
+@after { gParent.popMsg(state); }
+    : db=identifier DOT fn=identifier
+    -> Identifier[$db.text + "." + $fn.text]
+    |
+    identifier
+    ;
+
 nonReserved
     :
     KW_TRUE | KW_FALSE | KW_LIKE | KW_EXISTS | KW_ASC | KW_DESC | KW_ORDER | 
KW_GROUP | KW_BY | KW_AS | KW_INSERT | KW_OVERWRITE | KW_OUTER | KW_LEFT | 
KW_RIGHT | KW_FULL | KW_PARTITION | KW_PARTITIONS | KW_TABLE | KW_TABLES | 
KW_COLUMNS | KW_INDEX | KW_INDEXES | KW_REBUILD | KW_FUNCTIONS | KW_SHOW | 
KW_MSCK | KW_REPAIR | KW_DIRECTORY | KW_LOCAL | KW_USING | KW_CLUSTER | 
KW_DISTRIBUTE | KW_SORT | KW_UNION | KW_LOAD | KW_EXPORT | KW_IMPORT | KW_DATA 
| KW_INPATH | KW_IS | KW_NULL | KW_CREATE | KW_EXTERNAL | KW_ALTER | KW_CHANGE 
| KW_FIRST | KW_AFTER | KW_DESCRIBE | KW_DROP | KW_RENAME | KW_IGNORE | 
KW_PROTECTION | KW_TO | KW_COMMENT | KW_BOOLEAN | KW_TINYINT | KW_SMALLINT | 
KW_INT | KW_BIGINT | KW_FLOAT | KW_DOUBLE | KW_DATE | KW_DATETIME | 
KW_TIMESTAMP | KW_DECIMAL | KW_STRING | KW_ARRAY | KW_STRUCT | KW_UNIONTYPE | 
KW_PARTITIONED | KW_CLUSTERED | KW_SORTED | KW_INTO | KW_BUCKETS | KW_ROW | 
KW_ROWS | KW_FORMAT | KW_DELIMITED | KW_FIELDS | KW_TERMINATED | KW_ESCAPED | 
KW_COLLECTION | 
 KW_ITEMS | KW_KEYS | KW_KEY_TYPE | KW_LINES | KW_STORED | KW_FILEFORMAT | 
KW_SEQUENCEFILE | KW_TEXTFILE | KW_RCFILE | KW_ORCFILE | KW_PARQUETFILE | 
KW_INPUTFORMAT | KW_OUTPUTFORMAT | KW_INPUTDRIVER | KW_OUTPUTDRIVER | 
KW_OFFLINE | KW_ENABLE | KW_DISABLE | KW_READONLY | KW_NO_DROP | KW_LOCATION | 
KW_BUCKET | KW_OUT | KW_OF | KW_PERCENT | KW_ADD | KW_REPLACE | KW_RLIKE | 
KW_REGEXP | KW_TEMPORARY | KW_EXPLAIN | KW_FORMATTED | KW_PRETTY | 
KW_DEPENDENCY | KW_LOGICAL | KW_SERDE | KW_WITH | KW_DEFERRED | 
KW_SERDEPROPERTIES | KW_DBPROPERTIES | KW_LIMIT | KW_SET | KW_UNSET | 
KW_TBLPROPERTIES | KW_IDXPROPERTIES | KW_VALUE_TYPE | KW_ELEM_TYPE | KW_MAPJOIN 
| KW_STREAMTABLE | KW_HOLD_DDLTIME | KW_CLUSTERSTATUS | KW_UTC | 
KW_UTCTIMESTAMP | KW_LONG | KW_DELETE | KW_PLUS | KW_MINUS | KW_FETCH | 
KW_INTERSECT | KW_VIEW | KW_IN | KW_DATABASES | KW_MATERIALIZED | KW_SCHEMA | 
KW_SCHEMAS | KW_GRANT | KW_REVOKE | KW_SSL | KW_UNDO | KW_LOCK | KW_LOCKS | 
KW_UNLOCK | KW_SHARED | KW_EXCLUSIVE | KW_PROCEDURE |
  KW_UNSIGNED | KW_WHILE | KW_READ | KW_READS | KW_PURGE | KW_RANGE | 
KW_ANALYZE | KW_BEFORE | KW_BETWEEN | KW_BOTH | KW_BINARY | KW_CONTINUE | 
KW_CURSOR | KW_TRIGGER | KW_RECORDREADER | KW_RECORDWRITER | KW_SEMI | 
KW_LATERAL | KW_TOUCH | KW_ARCHIVE | KW_UNARCHIVE | KW_COMPUTE | KW_STATISTICS 
| KW_USE | KW_OPTION | KW_CONCATENATE | KW_SHOW_DATABASE | KW_UPDATE | 
KW_RESTRICT | KW_CASCADE | KW_SKEWED | KW_ROLLUP | KW_CUBE | KW_DIRECTORIES | 
KW_FOR | KW_GROUPING | KW_SETS | KW_TRUNCATE | KW_NOSCAN | KW_USER | KW_ROLE | 
KW_ROLES | KW_INNER | KW_DEFINED | KW_ADMIN

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MacroSemanticAnalyzer.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MacroSemanticAnalyzer.java?rev=1567811&r1=1567810&r2=1567811&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MacroSemanticAnalyzer.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MacroSemanticAnalyzer.java
 Wed Feb 12 23:58:41 2014
@@ -35,6 +35,7 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hadoop.hive.ql.exec.ColumnInfo;
 import org.apache.hadoop.hive.ql.exec.FunctionRegistry;
+import org.apache.hadoop.hive.ql.exec.FunctionUtils;
 import org.apache.hadoop.hive.ql.exec.TaskFactory;
 import org.apache.hadoop.hive.ql.lib.Dispatcher;
 import org.apache.hadoop.hive.ql.lib.Node;
@@ -73,6 +74,12 @@ public class MacroSemanticAnalyzer exten
   @SuppressWarnings("unchecked")
   private void analyzeCreateMacro(ASTNode ast) throws SemanticException {
     String functionName = ast.getChild(0).getText();
+
+    // Temp macros are not allowed to have qualified names.
+    if (FunctionUtils.isQualifiedFunctionName(functionName)) {
+      throw new SemanticException("Temporary macro cannot be created with a 
qualified name.");
+    }
+
     List<FieldSchema> arguments =
       BaseSemanticAnalyzer.getColumns((ASTNode)ast.getChild(1), true);
     boolean isNoArgumentMacro = arguments.size() == 0;
@@ -80,6 +87,7 @@ public class MacroSemanticAnalyzer exten
     ArrayList<String> macroColNames = new ArrayList<String>(arguments.size());
     ArrayList<TypeInfo> macroColTypes = new 
ArrayList<TypeInfo>(arguments.size());
     final Set<String> actualColumnNames = new HashSet<String>();
+
     if(!isNoArgumentMacro) {
       /*
        * Walk down expression to see which arguments are actually used.

Added: hive/trunk/ql/src/test/queries/clientnegative/udf_invalid.q
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/udf_invalid.q?rev=1567811&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/udf_invalid.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/udf_invalid.q Wed Feb 12 
23:58:41 2014
@@ -0,0 +1 @@
+select default.nonexistfunc() from src;

Added: hive/trunk/ql/src/test/queries/clientnegative/udf_qualified_name.q
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/udf_qualified_name.q?rev=1567811&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/udf_qualified_name.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/udf_qualified_name.q Wed Feb 
12 23:58:41 2014
@@ -0,0 +1 @@
+create temporary function default.myfunc as 
'org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum';

Added: hive/trunk/ql/src/test/results/clientnegative/udf_invalid.q.out
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/udf_invalid.q.out?rev=1567811&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/udf_invalid.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/udf_invalid.q.out Wed Feb 12 
23:58:41 2014
@@ -0,0 +1 @@
+FAILED: SemanticException Line 0:-1 Invalid function 'default.nonexistfunc'

Added: hive/trunk/ql/src/test/results/clientnegative/udf_qualified_name.q.out
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/udf_qualified_name.q.out?rev=1567811&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/udf_qualified_name.q.out 
(added)
+++ hive/trunk/ql/src/test/results/clientnegative/udf_qualified_name.q.out Wed 
Feb 12 23:58:41 2014
@@ -0,0 +1 @@
+FAILED: SemanticException Temporary function cannot be created with a 
qualified name.


Reply via email to