hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harisan...@apache.org
Subject hive git commit: HIVE-12570 : Incorrect error message Expression not in GROUP BY key thrown instead of Invalid function (Hari Subramaniyan, reviewed by Laljo John Pullokkaran)
Date Tue, 15 Dec 2015 00:12:02 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1 f14b3c6d6 -> e2c8bfa12


HIVE-12570 : Incorrect error message Expression not in GROUP BY key thrown instead of Invalid
function (Hari Subramaniyan, reviewed by Laljo John Pullokkaran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/e2c8bfa1
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e2c8bfa1
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e2c8bfa1

Branch: refs/heads/branch-1
Commit: e2c8bfa12c7b8e218c78618424362bb347c86094
Parents: f14b3c6
Author: Hari Subramaniyan <harisankar@apache.org>
Authored: Mon Dec 14 16:10:39 2015 -0800
Committer: Hari Subramaniyan <harisankar@apache.org>
Committed: Mon Dec 14 16:11:45 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java   | 4 ++++
 ql/src/test/queries/clientnegative/invalid_select_fn.q           | 1 +
 ql/src/test/results/clientnegative/invalid_select_fn.q.out       | 1 +
 ql/src/test/results/clientnegative/udf_invalid.q.out             | 2 +-
 ql/src/test/results/compiler/errors/unknown_function1.q.out      | 2 +-
 ql/src/test/results/compiler/errors/unknown_function4.q.out      | 2 +-
 6 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 71ec3d4..7bc6977 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -530,6 +530,10 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
       if (expressionTree.getChild(0).getType() == HiveParser.Identifier) {
         String functionName = unescapeIdentifier(expressionTree.getChild(0)
             .getText());
+        // Validate the function name
+        if (FunctionRegistry.getFunctionInfo(functionName) == null) {
+          throw new SemanticException(ErrorMsg.INVALID_FUNCTION.getMsg(functionName));
+        }
         if(FunctionRegistry.impliesOrder(functionName)) {
           throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName));
         }

http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/test/queries/clientnegative/invalid_select_fn.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/invalid_select_fn.q b/ql/src/test/queries/clientnegative/invalid_select_fn.q
new file mode 100644
index 0000000..b01d29b
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/invalid_select_fn.q
@@ -0,0 +1 @@
+explain create table src_invalid as select average(key) as key_avg from src group by value;

http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/test/results/clientnegative/invalid_select_fn.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/invalid_select_fn.q.out b/ql/src/test/results/clientnegative/invalid_select_fn.q.out
new file mode 100644
index 0000000..6023f55
--- /dev/null
+++ b/ql/src/test/results/clientnegative/invalid_select_fn.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException [Error 10011]: Invalid function average

http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/test/results/clientnegative/udf_invalid.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_invalid.q.out b/ql/src/test/results/clientnegative/udf_invalid.q.out
index c394cc8..29b6cc3 100644
--- a/ql/src/test/results/clientnegative/udf_invalid.q.out
+++ b/ql/src/test/results/clientnegative/udf_invalid.q.out
@@ -1 +1 @@
-FAILED: SemanticException Line 0:-1 Invalid function 'default.nonexistfunc'
+FAILED: SemanticException [Error 10011]: Invalid function default.nonexistfunc

http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/test/results/compiler/errors/unknown_function1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/compiler/errors/unknown_function1.q.out b/ql/src/test/results/compiler/errors/unknown_function1.q.out
index c6af515..8e1343b 100644
--- a/ql/src/test/results/compiler/errors/unknown_function1.q.out
+++ b/ql/src/test/results/compiler/errors/unknown_function1.q.out
@@ -1,2 +1,2 @@
 Semantic Exception: 
-Line 2:44 Invalid function 'dummyfn'
\ No newline at end of file
+Invalid function dummyfn
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/e2c8bfa1/ql/src/test/results/compiler/errors/unknown_function4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/compiler/errors/unknown_function4.q.out b/ql/src/test/results/compiler/errors/unknown_function4.q.out
index c6af515..8e1343b 100644
--- a/ql/src/test/results/compiler/errors/unknown_function4.q.out
+++ b/ql/src/test/results/compiler/errors/unknown_function4.q.out
@@ -1,2 +1,2 @@
 Semantic Exception: 
-Line 2:44 Invalid function 'dummyfn'
\ No newline at end of file
+Invalid function dummyfn
\ No newline at end of file


Mime
View raw message