NNamed
NNamed

Reputation: 727

Hive - set partitioning of external table based on file path

I have a job that is writing files to hdfs accorring to the following format:

/table_name/yyyy/MM/dd/HH/mm/ss/file_name.avro

Is it possible to define Hive external table that is being partitioned by both year and timestamp (HH:mm:ss) without moving files and renaming the directories?

Upvotes: 0

Views: 392

Answers (1)

HakkiBuyukcengiz
HakkiBuyukcengiz

Reputation: 419

You can implement this by writing load data statements for each yyyy/HH/mm/ss instance.

LOAD DATA INPATH '/table_name/yyyy/MM/dd/HH/mm/ss/file_name.avro' INTO TABLE tablename PARTITION (year=yyyy, hour=HH, minute=mm, second=ss)

Upvotes: 2

Related Questions