Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 847B1D41B for ; Fri, 7 Sep 2012 23:51:24 +0000 (UTC) Received: (qmail 58163 invoked by uid 500); 7 Sep 2012 23:51:24 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 58093 invoked by uid 500); 7 Sep 2012 23:51:24 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 58084 invoked by uid 99); 7 Sep 2012 23:51:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Sep 2012 23:51:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Sep 2012 23:51:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5B30423889E2 for ; Fri, 7 Sep 2012 23:50:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1382211 [1/3] - in /hive/trunk: ql/src/test/queries/clientpositive/ ql/src/test/results/clientpositive/ serde/if/test/ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/ serde/src/java/org/apache/hadoop/hive/serde... Date: Fri, 07 Sep 2012 23:50:38 -0000 To: commits@hive.apache.org From: hashutosh@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120907235039.5B30423889E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hashutosh Date: Fri Sep 7 23:50:38 2012 New Revision: 1382211 URL: http://svn.apache.org/viewvc?rev=1382211&view=rev Log: HIVE-3323 : enum to string conversions (Travis Crawford via Ashutosh Chauhan) Added: hive/trunk/ql/src/test/queries/clientpositive/convert_enum_to_string.q hive/trunk/ql/src/test/results/clientpositive/convert_enum_to_string.q.out hive/trunk/serde/if/test/megastruct.thrift hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MiniStruct.java hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MyEnum.java Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaStringObjectInspector.java Added: hive/trunk/ql/src/test/queries/clientpositive/convert_enum_to_string.q URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/convert_enum_to_string.q?rev=1382211&view=auto ============================================================================== --- hive/trunk/ql/src/test/queries/clientpositive/convert_enum_to_string.q (added) +++ hive/trunk/ql/src/test/queries/clientpositive/convert_enum_to_string.q Fri Sep 7 23:50:38 2012 @@ -0,0 +1,10 @@ +-- Ensure Enum fields are converted to strings (instead of struct) + +create table convert_enum_to_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.MegaStruct", + "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol"); + +describe convert_enum_to_string; Added: hive/trunk/ql/src/test/results/clientpositive/convert_enum_to_string.q.out URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/convert_enum_to_string.q.out?rev=1382211&view=auto ============================================================================== --- hive/trunk/ql/src/test/results/clientpositive/convert_enum_to_string.q.out (added) +++ hive/trunk/ql/src/test/results/clientpositive/convert_enum_to_string.q.out Fri Sep 7 23:50:38 2012 @@ -0,0 +1,44 @@ +PREHOOK: query: -- Ensure Enum fields are converted to strings (instead of struct) + +create table convert_enum_to_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.MegaStruct", + "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol") +PREHOOK: type: CREATETABLE +POSTHOOK: query: -- Ensure Enum fields are converted to strings (instead of struct) + +create table convert_enum_to_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.MegaStruct", + "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol") +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: default@convert_enum_to_string +PREHOOK: query: describe convert_enum_to_string +PREHOOK: type: DESCTABLE +POSTHOOK: query: describe convert_enum_to_string +POSTHOOK: type: DESCTABLE +my_bool boolean from deserializer +my_byte tinyint from deserializer +my_16bit_int smallint from deserializer +my_32bit_int int from deserializer +my_64bit_int bigint from deserializer +my_double double from deserializer +my_string string from deserializer +my_binary struct from deserializer +my_string_string_map map from deserializer +my_string_enum_map map from deserializer +my_enum_string_map map from deserializer +my_enum_struct_map map> from deserializer +my_enum_stringlist_map map> from deserializer +my_enum_structlist_map map>> from deserializer +my_stringlist array from deserializer +my_structlist array> from deserializer +my_enumlist array from deserializer +my_stringset struct<> from deserializer +my_enumset struct<> from deserializer +my_structset struct<> from deserializer +b string Added: hive/trunk/serde/if/test/megastruct.thrift URL: http://svn.apache.org/viewvc/hive/trunk/serde/if/test/megastruct.thrift?rev=1382211&view=auto ============================================================================== --- hive/trunk/serde/if/test/megastruct.thrift (added) +++ hive/trunk/serde/if/test/megastruct.thrift Fri Sep 7 23:50:38 2012 @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MetaStruct intends to stress test Hive's thrift support by having all + * sorts of crazy but valid field types. Please add new fields if you find + * a case that's not handled correctly. + */ + +namespace java org.apache.hadoop.hive.serde2.thrift.test + +enum MyEnum { + LLAMA = 1, + ALPACA = 2 +} + +struct MiniStruct { + 1: optional string my_string, + 2: optional MyEnum my_enum +} + +struct MegaStruct { + 1: optional bool my_bool, + 2: optional byte my_byte, + 3: optional i16 my_16bit_int, + 4: optional i32 my_32bit_int, + 5: optional i64 my_64bit_int, + 6: optional double my_double, + 7: optional string my_string, + 8: optional binary my_binary, + 9: optional map my_string_string_map, + 10: optional map my_string_enum_map, + 11: optional map my_enum_string_map, + 12: optional map my_enum_struct_map, + 13: optional map> my_enum_stringlist_map, + 14: optional map> my_enum_structlist_map, + 15: optional list my_stringlist, + 16: optional list my_structlist, + 17: optional list my_enumlist, + 18: optional set my_stringset, + 19: optional set my_enumset, + 20: optional set my_structset +}