You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ec...@apache.org on 2013/07/21 18:50:25 UTC
svn commit: r1505418 - 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: ecapriolo
Date: Sun Jul 21 16:50:25 2013
New Revision: 1505418
URL: http://svn.apache.org/r1505418
Log:
Serde-reported partition cols should not be persisted in metastore (Travis Crawford via egc)
Submitted by: Travis Crawford
Reviewed by: Edward Capriolo
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
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
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java?rev=1505418&r1=1505417&r2=1505418&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 Sun Jul 21 16:50:25 2013
@@ -47,6 +47,7 @@ import org.apache.hadoop.hive.ql.io.Hive
import org.apache.hadoop.hive.ql.io.HiveOutputFormat;
import org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat;
import org.apache.hadoop.hive.serde2.Deserializer;
+import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
@@ -200,7 +201,7 @@ public class Partition implements Serial
}
}
// set default if columns are not set
- if (tPartition.getSd().getCols() == null || tPartition.getSd().getCols().size() == 0) {
+ if (tPartition.getSd().getCols() == null) {
if (table.getCols() != null) {
tPartition.getSd().setCols(table.getCols());
}
@@ -519,7 +520,19 @@ public class Partition implements Serial
}
public List<FieldSchema> getCols() {
- return tPartition.getSd().getCols();
+ if (!SerDeUtils.shouldGetColsFromSerDe(
+ tPartition.getSd().getSerdeInfo().getSerializationLib())) {
+ return tPartition.getSd().getCols();
+ }
+
+ try {
+ return Hive.getFieldsFromDeserializer(table.getTableName(), getDeserializer());
+ } catch (HiveException e) {
+ LOG.error("Unable to get cols from serde: " +
+ tPartition.getSd().getSerdeInfo().getSerializationLib(), e);
+ }
+
+ return new ArrayList<FieldSchema>();
}
public String getLocation() {
Modified: 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=1505418&r1=1505417&r2=1505418&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/serde_reported_schema.q Sun Jul 21 16:50:25 2013
@@ -4,6 +4,6 @@ create table int_string
with serdeproperties (
"serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.IntString",
"serialization.format"="org.apache.thrift.protocol.TBinaryProtocol");
-describe int_string;
+describe extended int_string;
alter table int_string add partition (b='part1');
-describe int_string partition (b='part1');
\ No newline at end of file
+describe extended int_string partition (b='part1');
Modified: 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=1505418&r1=1505417&r2=1505418&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/serde_reported_schema.q.out Sun Jul 21 16:50:25 2013
@@ -13,9 +13,9 @@ POSTHOOK: query: create table int_string
"serialization.format"="org.apache.thrift.protocol.TBinaryProtocol")
POSTHOOK: type: CREATETABLE
POSTHOOK: Output: default@int_string
-PREHOOK: query: describe int_string
+PREHOOK: query: describe extended int_string
PREHOOK: type: DESCTABLE
-POSTHOOK: query: describe int_string
+POSTHOOK: query: describe extended int_string
POSTHOOK: type: DESCTABLE
myint int from deserializer
mystring string from deserializer
@@ -26,6 +26,8 @@ b string
# col_name data_type comment
b string None
+
+#### A masked pattern was here ####
PREHOOK: query: alter table int_string add partition (b='part1')
PREHOOK: type: ALTERTABLE_ADDPARTS
PREHOOK: Input: default@int_string
@@ -33,9 +35,9 @@ POSTHOOK: query: alter table int_string
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: query: describe extended int_string partition (b='part1')
PREHOOK: type: DESCTABLE
-POSTHOOK: query: describe int_string partition (b='part1')
+POSTHOOK: query: describe extended int_string partition (b='part1')
POSTHOOK: type: DESCTABLE
myint int from deserializer
mystring string from deserializer
@@ -46,3 +48,5 @@ b string
# col_name data_type comment
b string None
+
+#### A masked pattern was here ####