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 2012/07/26 17:51:45 UTC

svn commit: r1366058 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/metadata/Partition.java test/queries/clientpositive/serde_reported_schema.q test/results/clientpositive/serde_reported_schema.q.out

Author: hashutosh
Date: Thu Jul 26 15:51:45 2012
New Revision: 1366058

URL: http://svn.apache.org/viewvc?rev=1366058&view=rev
Log:
HIVE-3279: Table schema not being copied to Partitions with no columns (Travis Crawford via Ashutosh Chauhan)

Added:
    hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q
    hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java?rev=1366058&r1=1366057&r2=1366058&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java Thu Jul 26 15:51:45 2012
@@ -198,7 +198,7 @@ public class Partition implements Serial
           }
         }
         // set default if columns are not set
-        if (tPartition.getSd().getCols() == null) {
+        if (tPartition.getSd().getCols() == null || tPartition.getSd().getCols().size() == 0) {
           if (table.getCols() != null) {
             tPartition.getSd().setCols(table.getCols());
           }

Added: hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q?rev=1366058&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q Thu Jul 26 15:51:45 2012
@@ -0,0 +1,9 @@
+create table int_string
+  partitioned by (b string)
+  row format serde "org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer"
+    with serdeproperties (
+      "serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.IntString",
+      "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol");
+describe int_string;
+alter table int_string add partition (b='part1');
+describe int_string partition (b='part1');
\ No newline at end of file

Added: hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out?rev=1366058&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out Thu Jul 26 15:51:45 2012
@@ -0,0 +1,38 @@
+PREHOOK: query: create table int_string
+  partitioned by (b string)
+  row format serde "org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer"
+    with serdeproperties (
+      "serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.IntString",
+      "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol")
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table int_string
+  partitioned by (b string)
+  row format serde "org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer"
+    with serdeproperties (
+      "serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.IntString",
+      "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@int_string
+PREHOOK: query: describe int_string
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: describe int_string
+POSTHOOK: type: DESCTABLE
+myint	int	from deserializer
+mystring	string	from deserializer
+underscore_int	int	from deserializer
+b	string	
+PREHOOK: query: alter table int_string add partition (b='part1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@int_string
+POSTHOOK: query: alter table int_string add partition (b='part1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@int_string
+POSTHOOK: Output: default@int_string@b=part1
+PREHOOK: query: describe int_string partition (b='part1')
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: describe int_string partition (b='part1')
+POSTHOOK: type: DESCTABLE
+myint	int	from deserializer
+mystring	string	from deserializer
+underscore_int	int	from deserializer
+b	string