You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/09/12 20:24:47 UTC
[15/31] hive git commit: HIVE-14686: Get unexpected command type when
execute query "CREATE TABLE IF NOT EXISTS ... AS" (Yunbo via Rui)
HIVE-14686: Get unexpected command type when execute query "CREATE TABLE IF NOT EXISTS ... AS" (Yunbo via Rui)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/407cfe18
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/407cfe18
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/407cfe18
Branch: refs/heads/hive-14535
Commit: 407cfe1856a234eae40b410db19381ae4cfa56e3
Parents: d2e294c
Author: Yunbo Fan <44...@qq.com>
Authored: Fri Sep 9 19:02:52 2016 +0800
Committer: Rui Li <sh...@cn.ibm.com>
Committed: Fri Sep 9 19:02:52 2016 +0800
----------------------------------------------------------------------
.../apache/hadoop/hive/ql/parse/SemanticAnalyzer.java | 12 ++++++++----
ql/src/test/results/clientpositive/ctas.q.out | 8 ++++----
ql/src/test/results/clientpositive/llap/ctas.q.out | 8 ++++----
.../results/clientpositive/llap/explainuser_1.q.out | 8 ++++----
ql/src/test/results/clientpositive/spark/ctas.q.out | 8 ++++----
5 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/407cfe18/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 489e70f..e4a37f4 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
@@ -11620,6 +11620,14 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
}
}
+ if (command_type == CREATE_TABLE || command_type == CTLT) {
+ queryState.setCommandType(HiveOperation.CREATETABLE);
+ } else if (command_type == CTAS) {
+ queryState.setCommandType(HiveOperation.CREATETABLE_AS_SELECT);
+ } else {
+ throw new SemanticException("Unrecognized command.");
+ }
+
storageFormat.fillDefaultStorageFormat(isExt);
if ((command_type == CTAS) && (storageFormat.getStorageHandler() != null)) {
@@ -11681,7 +11689,6 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
crtTblDesc.validate(conf);
// outputs is empty, which means this create table happens in the current
// database.
- queryState.setCommandType(HiveOperation.CREATETABLE);
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
crtTblDesc), conf));
break;
@@ -11700,7 +11707,6 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
storageFormat.getInputFormat(), storageFormat.getOutputFormat(), location,
storageFormat.getSerde(), storageFormat.getSerdeProps(), tblProps, ifNotExists,
likeTableName, isUserStorageFormat);
- queryState.setCommandType(HiveOperation.CREATETABLE);
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
crtTblLikeDesc), conf));
break;
@@ -11774,8 +11780,6 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
tableDesc.setNullFormat(rowFormatParams.nullFormat);
qb.setTableDesc(tableDesc);
- queryState.setCommandType(HiveOperation.CREATETABLE_AS_SELECT);
-
return selectStmt;
default:
throw new SemanticException("Unrecognized command.");
http://git-wip-us.apache.org/repos/asf/hive/blob/407cfe18/ql/src/test/results/clientpositive/ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ctas.q.out b/ql/src/test/results/clientpositive/ctas.q.out
index afd6d7c..7f1c912 100644
--- a/ql/src/test/results/clientpositive/ctas.q.out
+++ b/ql/src/test/results/clientpositive/ctas.q.out
@@ -474,16 +474,16 @@ Sort Columns: []
Storage Desc Params:
serialization.format 1
PREHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
STAGE DEPENDENCIES:
STAGE PLANS:
PREHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: query: select * from nzhang_ctas3
PREHOOK: type: QUERY
PREHOOK: Input: default@nzhang_ctas3
http://git-wip-us.apache.org/repos/asf/hive/blob/407cfe18/ql/src/test/results/clientpositive/llap/ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/ctas.q.out b/ql/src/test/results/clientpositive/llap/ctas.q.out
index f48d431..dab0251 100644
--- a/ql/src/test/results/clientpositive/llap/ctas.q.out
+++ b/ql/src/test/results/clientpositive/llap/ctas.q.out
@@ -489,16 +489,16 @@ Sort Columns: []
Storage Desc Params:
serialization.format 1
PREHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
STAGE DEPENDENCIES:
STAGE PLANS:
PREHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: query: select * from nzhang_ctas3
PREHOOK: type: QUERY
PREHOOK: Input: default@nzhang_ctas3
http://git-wip-us.apache.org/repos/asf/hive/blob/407cfe18/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
index ef01018..70ec02f 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
@@ -3393,14 +3393,14 @@ POSTHOOK: Output: default@nzhang_ctas3
POSTHOOK: Lineage: nzhang_ctas3.conb EXPRESSION [(src)src.FieldSchema(name:value, type:string, comment:default), ]
POSTHOOK: Lineage: nzhang_ctas3.half_key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ]
PREHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: query: explain create temporary table acid_dtt(a int, b varchar(128)) clustered by (a) into 2 buckets stored as orc TBLPROPERTIES ('transactional'='true')
PREHOOK: type: CREATETABLE
POSTHOOK: query: explain create temporary table acid_dtt(a int, b varchar(128)) clustered by (a) into 2 buckets stored as orc TBLPROPERTIES ('transactional'='true')
http://git-wip-us.apache.org/repos/asf/hive/blob/407cfe18/ql/src/test/results/clientpositive/spark/ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ctas.q.out b/ql/src/test/results/clientpositive/spark/ctas.q.out
index f7165fc..7a44cc7 100644
--- a/ql/src/test/results/clientpositive/spark/ctas.q.out
+++ b/ql/src/test/results/clientpositive/spark/ctas.q.out
@@ -462,16 +462,16 @@ Sort Columns: []
Storage Desc Params:
serialization.format 1
PREHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: explain create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
STAGE DEPENDENCIES:
STAGE PLANS:
PREHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-PREHOOK: type: CREATETABLE
+PREHOOK: type: CREATETABLE_AS_SELECT
POSTHOOK: query: create table if not exists nzhang_ctas3 as select key, value from src sort by key, value limit 2
-POSTHOOK: type: CREATETABLE
+POSTHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: query: select * from nzhang_ctas3
PREHOOK: type: QUERY
PREHOOK: Input: default@nzhang_ctas3