Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 3505 invoked from network); 21 Jan 2009 23:00:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jan 2009 23:00:26 -0000 Received: (qmail 31320 invoked by uid 500); 21 Jan 2009 23:00:25 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 31300 invoked by uid 500); 21 Jan 2009 23:00:25 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 31291 invoked by uid 99); 21 Jan 2009 23:00:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2009 15:00:25 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2009 23:00:24 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 3FA4D118DD for ; Wed, 21 Jan 2009 23:00:04 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: core-commits@hadoop.apache.org Date: Wed, 21 Jan 2009 23:00:03 -0000 Message-ID: <20090121230003.697.60082@eos.apache.org> Subject: [Hadoop Wiki] Update of "Hive/HiveQL/Types" by ZhengShao X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification. The following page has been changed by ZhengShao: http://wiki.apache.org/hadoop/Hive/HiveQL/Types ------------------------------------------------------------------------------ - == Types supported By Hive == + [[TableOfContents]] + - Types are associated with the columns in the tables. Hive supports 2 sets of types: primitive types and complex types. + Types are associated with the columns in the tables. Hive supports 2 sets of types: primitive types and complex types. Hive also supports implicit and explicit conversions among these types. === Primitive Types === * !TinyInt: 1-byte signed integer from -2^7^ (-128) to 2^7^-1 (127). @@ -20, +21 @@ {{{ CREATE TABLE test_table ( - a TINYINT, + a TINYINT, - b SMALLINT, + b SMALLINT, - c INT, + c INT, - d BIGINT, + d BIGINT, - e DOUBLE, + e DOUBLE, - f BOOLEAN, + f BOOLEAN, - g STRING, + g STRING, ); }}} @@ -35, +36 @@ * Struct: the elements within the type can be accessed using the . notation e.g. for a column c of type struct {a int; b int} the a field is accessed by the expression a.c * Map (key-value tuples): The elements are accessed using ['element name'] notation e.g. in a map M comprising of a mapping from 'group' -> gid the gid value can be accessed using M['group'] * Array (indexable lists): The elements are accessed using the [n] notation where n is an index into the array e.g. for an array A having the elements ['a', 'b', 'c'], A[1] retruns 'b'. The index starts from 0. + + Examples of creating a table with columns of various complex types: + + {{{ + CREATE TABLE test_table ( + a ARRAY, + b MAP, + c MAP + ); + }}} == Implicit and Explicit Type Conversions == In most cases, users don't need to care about the types because Hive is able to do implicit type conversions.