Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: trivial edits & font changes

...

Complex Types

  • arrays: ARRAY<data_type> (As of Hive 0.14 Note: negative values and non-constant expressions are allowed as of Hive 0.14.)
  • maps: MAP<primitive_type, data_type> (As of Hive 0.14 negative Note: negative values and non-constant expressions are allowed as of Hive 0.14.)
  • structs: STRUCT<col_name : data_type [COMMENT col_comment], ...>
  • union: UNIONTYPE<data_type, data_type, ...> (Note: Only available starting with Hive 0.7.0.)

Column Types

Integral Types (TINYINT, SMALLINT, INT, BIGINT)

...

  1. Determine what precision/scale you would like to set for the decimal column in the table.
  2. For each decimal column in the table, update the column definition to the desired precision/scale using the ALTER TABLE command:

    Code Block
    sql
    sql
    ALTER TABLE foo CHANGE COLUMN dec_column_name dec_column_name DECIMAL(38,18);

    If the table is not a partitioned table, then you are done.  If the table has partitions, then go on to step 3.

  3. If the table is a partitioned table, then find the list of partitions for the table:

    Code Block
    sql
    sql
    SHOW PARTITIONS foo;
     
    ds=2008-04-08/hr=11
    ds=2008-04-08/hr=12
    ...
  4. For each existing partition in the table, the same set of ALTER TABLE CHANGE COLUMN commands must be issued, this time on the partition. (This is available in Hive 0.14 or later, with HIVE-7971.)

    Code Block
    sql
    sql
    ALTER TABLE foo PARTITION (ds='2008-04-08', hr=11) CHANGE COLUMN dec_column_name dec_column_name DECIMAL(38,18);
    ALTER TABLE foo PARTITION (ds='2008-04-08', hr=12) CHANGE COLUMN dec_column_name dec_column_name DECIMAL(38,18);
    ...

...