HIVE-10771: 'separatorChar' has no effect in 'CREATE TABLE AS SELECT' statement 
(Yongzhi via Xuefu)


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

Branch: refs/heads/branch-1.2
Commit: e1b7bf741799ead1729c8e47ed23907fb02abd9d
Parents: 442f632
Author: Xuefu Zhang <xzh...@cloudera.com>
Authored: Wed May 27 11:15:05 2015 -0700
Committer: Pengcheng Xiong <pxi...@apache.org>
Committed: Fri Sep 4 17:27:36 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/plan/PlanUtils.java   |  3 ++
 .../clientpositive/crtseltbl_serdeprops.q       | 11 ++++++
 .../clientpositive/crtseltbl_serdeprops.q.out   | 35 ++++++++++++++++++++
 3 files changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e1b7bf74/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
index 5d41c69..cb0b680 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
@@ -355,6 +355,9 @@ public final class PlanUtils {
       if (crtTblDesc.getTblProps() != null) {
         properties.putAll(crtTblDesc.getTblProps());
       }
+      if (crtTblDesc.getSerdeProps() != null) {
+        properties.putAll(crtTblDesc.getSerdeProps());
+      }
 
       // replace the default input & output file format with those found in
       // crtTblDesc

http://git-wip-us.apache.org/repos/asf/hive/blob/e1b7bf74/ql/src/test/queries/clientpositive/crtseltbl_serdeprops.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/crtseltbl_serdeprops.q 
b/ql/src/test/queries/clientpositive/crtseltbl_serdeprops.q
new file mode 100644
index 0000000..6e73bc2
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/crtseltbl_serdeprops.q
@@ -0,0 +1,11 @@
+dfs ${system:test.dfs.mkdir} ${system:test.tmp.dir}/tmpsepatest;
+CREATE TABLE separator_test 
+ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
+WITH SERDEPROPERTIES ("separatorChar" = "|","quoteChar"="\"","escapeChar"="
+") 
+STORED AS TEXTFILE
+LOCATION 'file:${system:test.tmp.dir}/tmpsepatest'
+AS
+SELECT * FROM src where key = 100 limit 1; 
+dfs -cat ${system:test.tmp.dir}/tmpsepatest/000000_0;
+drop table separator_test;

http://git-wip-us.apache.org/repos/asf/hive/blob/e1b7bf74/ql/src/test/results/clientpositive/crtseltbl_serdeprops.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/crtseltbl_serdeprops.q.out 
b/ql/src/test/results/clientpositive/crtseltbl_serdeprops.q.out
new file mode 100644
index 0000000..3af9150
--- /dev/null
+++ b/ql/src/test/results/clientpositive/crtseltbl_serdeprops.q.out
@@ -0,0 +1,35 @@
+PREHOOK: query: CREATE TABLE separator_test 
+ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
+WITH SERDEPROPERTIES ("separatorChar" = "|","quoteChar"="\"","escapeChar"="
+") 
+STORED AS TEXTFILE
+#### A masked pattern was here ####
+AS
+SELECT * FROM src where key = 100 limit 1
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+PREHOOK: Output: database:default
+PREHOOK: Output: default@separator_test
+POSTHOOK: query: CREATE TABLE separator_test 
+ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
+WITH SERDEPROPERTIES ("separatorChar" = "|","quoteChar"="\"","escapeChar"="
+") 
+STORED AS TEXTFILE
+#### A masked pattern was here ####
+AS
+SELECT * FROM src where key = 100 limit 1
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@separator_test
+"100"|"val_100"
+PREHOOK: query: drop table separator_test
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@separator_test
+PREHOOK: Output: default@separator_test
+POSTHOOK: query: drop table separator_test
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@separator_test
+POSTHOOK: Output: default@separator_test

Reply via email to