Repository: hive Updated Branches: refs/heads/master 2d87c12d9 -> 3fa7489e2
HIVE-10679: JsonSerde ignores varchar and char size limit specified during table creation (Jason Dere, reviewed by Hari Subramaniyan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/3fa7489e Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/3fa7489e Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/3fa7489e Branch: refs/heads/master Commit: 3fa7489e2d6640d2b16e9c23754f2d5590dfe5e4 Parents: 2d87c12 Author: Hari Subramaniyan <harisan...@apache.org> Authored: Thu May 14 15:19:43 2015 -0700 Committer: Hari Subramaniyan <harisan...@apache.org> Committed: Thu May 14 15:19:43 2015 -0700 ---------------------------------------------------------------------- .../data/HCatRecordObjectInspectorFactory.java | 2 +- .../clientpositive/json_serde_qualified_types.q | 12 +++++++ .../json_serde_qualified_types.q.out | 33 ++++++++++++++++++++ .../PrimitiveObjectInspectorFactory.java | 4 +-- 4 files changed, 48 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/3fa7489e/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java ---------------------------------------------------------------------- diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java index 81daa2d..389395e 100644 --- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java +++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java @@ -93,7 +93,7 @@ public class HCatRecordObjectInspectorFactory { switch (typeInfo.getCategory()) { case PRIMITIVE: oi = PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector( - ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory()); + (PrimitiveTypeInfo) typeInfo); break; case STRUCT: StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo; http://git-wip-us.apache.org/repos/asf/hive/blob/3fa7489e/ql/src/test/queries/clientpositive/json_serde_qualified_types.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/json_serde_qualified_types.q b/ql/src/test/queries/clientpositive/json_serde_qualified_types.q new file mode 100644 index 0000000..8968b9a --- /dev/null +++ b/ql/src/test/queries/clientpositive/json_serde_qualified_types.q @@ -0,0 +1,12 @@ + +add jar ${system:maven.local.repository}/org/apache/hive/hcatalog/hive-hcatalog-core/${system:hive.version}/hive-hcatalog-core-${system:hive.version}.jar; + +create table json_serde_qualified_types ( + c1 char(10), + c2 varchar(20), + c3 decimal(10, 5) +) row format serde 'org.apache.hive.hcatalog.data.JsonSerDe'; + +describe json_serde_qualified_types; + +drop table json_serde_qualified_types; http://git-wip-us.apache.org/repos/asf/hive/blob/3fa7489e/ql/src/test/results/clientpositive/json_serde_qualified_types.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/json_serde_qualified_types.q.out b/ql/src/test/results/clientpositive/json_serde_qualified_types.q.out new file mode 100644 index 0000000..0e0ba4e --- /dev/null +++ b/ql/src/test/results/clientpositive/json_serde_qualified_types.q.out @@ -0,0 +1,33 @@ +PREHOOK: query: create table json_serde_qualified_types ( + c1 char(10), + c2 varchar(20), + c3 decimal(10, 5) +) row format serde 'org.apache.hive.hcatalog.data.JsonSerDe' +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@json_serde_qualified_types +POSTHOOK: query: create table json_serde_qualified_types ( + c1 char(10), + c2 varchar(20), + c3 decimal(10, 5) +) row format serde 'org.apache.hive.hcatalog.data.JsonSerDe' +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@json_serde_qualified_types +PREHOOK: query: describe json_serde_qualified_types +PREHOOK: type: DESCTABLE +PREHOOK: Input: default@json_serde_qualified_types +POSTHOOK: query: describe json_serde_qualified_types +POSTHOOK: type: DESCTABLE +POSTHOOK: Input: default@json_serde_qualified_types +c1 char(10) from deserializer +c2 varchar(20) from deserializer +c3 decimal(10,5) from deserializer +PREHOOK: query: drop table json_serde_qualified_types +PREHOOK: type: DROPTABLE +PREHOOK: Input: default@json_serde_qualified_types +PREHOOK: Output: default@json_serde_qualified_types +POSTHOOK: query: drop table json_serde_qualified_types +POSTHOOK: type: DROPTABLE +POSTHOOK: Input: default@json_serde_qualified_types +POSTHOOK: Output: default@json_serde_qualified_types http://git-wip-us.apache.org/repos/asf/hive/blob/3fa7489e/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java ---------------------------------------------------------------------- diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java index 7cd50ca..2ed0843 100644 --- a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java +++ b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java @@ -391,8 +391,8 @@ public final class PrimitiveObjectInspectorFactory { case DECIMAL: result = new JavaHiveDecimalObjectInspector((DecimalTypeInfo)typeInfo); break; - default: - throw new RuntimeException("Failed to create JavaHiveVarcharObjectInspector for " + typeInfo ); + default: + throw new RuntimeException("Failed to create Java ObjectInspector for " + typeInfo); } AbstractPrimitiveJavaObjectInspector prev =