0

I have multiple existing tables stored in hdfs. I would like to create new tables from the existing external tables so that I can bucket, sort, and compress the data.

What is the proper way to create a table from the existing table? I could export the existing table to CSV, then create a new table and import it but it seems like there should be a way to import the data directly from the existing table but I haven't found anything in the documentation or via google.

kira_codes
  • 1,457
  • 13
  • 38

1 Answers1

1

For some existing table named: source and a newly created table named: target with fields: a,b,c,d

Reading all entries from source and writing to target:

insert overwrite table target select distinct a,b,c,d from source;

This works for both internal and external tables.

kira_codes
  • 1,457
  • 13
  • 38