Creating an Ozone-based external table

You use the LOCATION clause in the CREATE EXTERNAL TABLE statment to create an external data having source data on Ozone.

In this task, you create a partitioned, external table and load data from the source on Ozone. You can use the LOCATION clause in the CREATE TABLE to specify the location of external table data. The metadata is stored in the Hive warehouse.
  • Set up Hive policies in Ranger to include Ozone URLs.
  1. Put data source files on Ozone.
  2. Create an external table based on the data source files.
    CREATE EXTERNAL TABLE `inventory`(
      `inv_item_sk` int,
      `inv_warehouse_sk` int,
      `inv_quantity_on_hand` int)
      PARTITIONED BY (
      `inv_date_sk` int) STORED AS ORC
      LOCATION
      'ofs://ozone1/vol1/bucket1/employee_hive';