Inserting Data Into Bucketed Tables


Let us see how we can add data to bucketed tables.

  • Typically we use INSERT command to get data into bucketed tables, as source data might not match the criterial of our bucketed table.
  • If the data is in files, first we need to get data to stage and then insert into bucketed table.
  • We already have data in orders table, let us use to insert data into our bucketed table orders_buck
  • hive.enforce.bucketing should be set to true.

Here is the example of inserting data into bucketed table from regular managed or external table.

INSERT INTO orders_buck
SELECT * FROM orders;

dfs -ls /apps/hive/warehouse/training_retail.db/orders_buck;

SELECT * FROM orders_buck LIMIT 10;

Practice hive on state of the art Big Data cluster -
You can sign up for our courses on Udemy using $10 coupons - Udemy Coupons - Big Data Courses