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<INT>,
+   b MAP<STRING, STRING>,
+   c MAP<STRING, INT>
+ );
+ }}}
  
  == 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.

Reply via email to