You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2016/07/16 19:07:44 UTC

hive git commit: HIVE-14226 : Invalid check on an ASTNode#toStringTree in CalcitePlanner (Barna Zsombor Klara via Jesus Camacho Rodriguez) Signed-off-by: Ashutosh Chauhan

Repository: hive
Updated Branches:
  refs/heads/master 47b5b5cdb -> 97649669d


HIVE-14226 : Invalid check on an ASTNode#toStringTree in CalcitePlanner (Barna Zsombor Klara via Jesus Camacho Rodriguez)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


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

Branch: refs/heads/master
Commit: 97649669d403909107e0d4e4fcc66fb0f7296963
Parents: 47b5b5c
Author: Barna Zsombor Klara <zs...@cloudera.com>
Authored: Sat Jul 16 12:06:37 2016 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Sat Jul 16 12:06:37 2016 -0700

----------------------------------------------------------------------
 ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java   | 2 +-
 ql/src/test/queries/clientnegative/selectDistinctWithoutAggr.q    | 3 +++
 .../test/results/clientnegative/selectDistinctWithoutAggr.q.out   | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/97649669/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index 8e5a3da..e12e589 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -2994,7 +2994,7 @@ public class CalcitePlanner extends SemanticAnalyzer {
               SemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0).getText()
                   .toLowerCase()), expr, col_list, excludedColumns, inputRR, starRR, pos,
               out_rwsch, tableMask.isEnabled() ? qb.getAliases() : tabAliasesForAllProjs, true);
-        } else if (expr.toStringTree().contains("TOK_FUNCTIONDI")
+        } else if (ParseUtils.containsTokenOfType(expr, HiveParser.TOK_FUNCTIONDI)
             && !(srcRel instanceof HiveAggregate)) {
           // Likely a malformed query eg, select hash(distinct c1) from t1;
           throw new CalciteSemanticException("Distinct without an aggreggation.",

http://git-wip-us.apache.org/repos/asf/hive/blob/97649669/ql/src/test/queries/clientnegative/selectDistinctWithoutAggr.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/selectDistinctWithoutAggr.q b/ql/src/test/queries/clientnegative/selectDistinctWithoutAggr.q
new file mode 100644
index 0000000..d031513
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/selectDistinctWithoutAggr.q
@@ -0,0 +1,3 @@
+-- Distinct without an aggregation is unsupported
+
+select hash(distinct key) from src;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/97649669/ql/src/test/results/clientnegative/selectDistinctWithoutAggr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/selectDistinctWithoutAggr.q.out b/ql/src/test/results/clientnegative/selectDistinctWithoutAggr.q.out
new file mode 100644
index 0000000..2f4bbde
--- /dev/null
+++ b/ql/src/test/results/clientnegative/selectDistinctWithoutAggr.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException 3:7 Distinct keyword is not support in current context. Error encountered near token 'key'