0

How we can create a hive table using ozone object store.

Ranga Reddy
  • 2,936
  • 4
  • 29
  • 41

1 Answers1

1

In order to create a hive table, first we need to create a volume and bucket in ozone.

Step1: Create the volume with the name vol1 in Apache Ozone.

# ozone sh volume create /vol1

Step2: Create the bucket with the name bucket1 under vol1.

# ozone sh bucket create /vol1/bucket1

Step3: Login to beeline shell

Step4: Create the hive database.

CREATE DATABASE IF NOT EXISTS ozone_db;
USE  ozone_db;

Step5: Create the hive table.

CREATE EXTERNAL TABLE IF NOT EXISTS `employee`(                  
   `id` bigint,                                     
   `name` string,                                   
   `age` smallint)
STORED AS parquet 
LOCATION 'o3fs://bucket1.vol1.om.host.example.com/employee';

Note: Update the om.host.example.com value.

Reference:

https://community.cloudera.com/t5/Community-Articles/Spark-Hive-Ozone-Integration-in-CDP/ta-p/323346

Ranga Reddy
  • 2,936
  • 4
  • 29
  • 41