Mapping a Hive External Table to rmvTable: Non-Secure Store

Assuming you have executed the initial steps to deploy a non-secure store, created and populated the table named rmvTable in that store, and configured the Hive client environment for interaction with Oracle NoSQL Database, you can then create an external Hive table that maps to that Oracle NoSQL Database table by executing the following Hive command:

CREATE EXTERNAL TABLE IF NOT EXISTS rmvTable
    (zipcode STRING, lastname STRING, firstname STRING, ssn BIGINT, 
        gender STRING, license BINARY, phoneinfo MAP<STRING, STRING>,
        address STRUCT<number:INT, street:STRING, 
            unit:INT, city:STRING, zip:INT>,
        vehicleinfo ARRAY<STRUCT<type:STRING, make:STRING, 
            model:STRING, class:STRING, color:STRING,  
            value:FLOAT, tax:DOUBLE, paid:BOOLEAN>>)
    COMMENT 'Hive mapped to NoSQL table: rmvTable'
    STORED BY 'oracle.kv.hadoop.hive.table.TableStorageHandler'
    TBLPROPERTIES 
        ("oracle.kv.kvstore" = "example-store", 
            "oracle.kv.hosts"= "kv-host-1:5000,kv-host-2:5000,kv-host-3:5000", 
            "oracle.kv.tableName" = "rmvTable", 
            "oracle.kv.hadoop.hosts" = "dn-host-1,dn-host-2,dn-host-3");

The command above applies the required data model mapping to create a Hive table named rmvTable with columns whose types are consistent with the corresponding fields of the Oracle NoSQL Database table specified via the oracle.kv.tableName property.

Although not necessary, the Hive table that is created is given the same name as the table to which it is mapped in the store.