1
votes

I have one hive table with date partitioned. These dates start from 2017-01-01.

HDFS locations is date partitioned.

How can I create a Hive table considering only 5 dates from above HDFS location?

1
Just to be clear, you have multiple files in HDFS location that are specific to each partition i.e date in this regard. So now you want to load the data for only 5 specific dates into the Hive table that you have created? - Joby
Do you want the new table as well to be partitioned - Immanuel Fredrick
@Joby I have multiple files in HDFS date wise location. When we say partitioned it should have the format as (HDFS_LOC/create_date=2017-10-19), but my HDFS location is (HDFS_LOC/2017-10-19) .Now i want to create a process which will create a hive table. This hive table will have last 5 dates prior to process run date from above HDFS date wise location. - Kamlesh Khollam
@ImmanuelFredrick When we say partitioned it should have the format as (HDFS_LOC/create_date=2017-10-19), but my HDFS location is (HDFS_LOC/2017-10-19) . And new hive table to be created with last 5 dates prior to process run date from above my HDFS date location (Loc1: HDFS_LOC/2017-10-25; Loc2: HDFS_LOC/2017-10-24 ; HDFS_LOC/2017-10-23; HDFS_LOC/2017-10-22; HDFS_LOC/2017-10-21) - Kamlesh Khollam

1 Answers

0
votes
create table newtable as select column1, column2, column3 from oldtable where  DateStamp >= '2017-01-01' and  DateStamp <= '2017-01-05'