Creating a CRUD transactional table in Hive

Hive supports creating a CRUD (Create, Read, Update, Delete) transactional table having ACID (atomic, consistent, isolated, and durable) properties. A CRUD table is a managed table that you can update, delete, and merge. You learn by example how to determine the table type.

In this task, you create a CRUD transactional table. You cannot sort this type of table. To create a CRUD transactional table, you must accept the default ORC format by not specifying any storage during table creation, or by specifying ORC storage explicitly.

Impala does not support creating a CRUD transactional table.

  1. Start Hive.
  2. Enter your user name and password.
    The Hive 3 connection message, followed by the Hive prompt for entering SQL queries on the command line, appears.
  3. Create a CRUD transactional table named T having two integer columns, a and b:
    Hive example:
    CREATE TABLE T(a int, b int);
  4. Confirm that you created a managed, ACID table.
    Hive example:
    DESCRIBE FORMATTED T;
    The output looks something like this:
    +-------------------------------+----------------------------------------------------+----------------------------------------------------+
    |           col_name            |                     data_type                      |                      comment                       |
    +-------------------------------+----------------------------------------------------+----------------------------------------------------+
    | a                             | int                                                |                                                    |
    | b                             | int                                                |                                                    |
    |                               | NULL                                               | NULL                                               |
    | # Detailed Table Information  | NULL                                               | NULL                                               |
    | Database:                     | default                                            | NULL                                               |
    | OwnerType:                    | USER                                               | NULL                                               |
    | Owner:                        | max                                              | NULL                                                 |
    | CreateTime:                   | Fri Jul 22 22:04:34 UTC 2022                       | NULL                                               |
    | LastAccessTime:               | UNKNOWN                                            | NULL                                               |
    | Retention:                    | 0                                                  | NULL                                               |
    | Location:                     | s3a://cdpsaasdemo-cdp-private-default-1ogvplm/warehouse/tablespace/managed/hive/t | NULL                |
    | Table Type:                   | MANAGED_TABLE                                      | NULL                                               |
    ...
    |                               | totalSize                                          | 0                                                  |
    |                               | transactional                                      | true          
    The table type says MANAGED_TABLE and transactional = true.