If I understand correctly, you have files in level 4 folders deep from the directory logs. In this case, you define your table as external using "logs" and divide it into 4 virtual fields: year, month, day_of_mech, hour_of_day.
Separation is essentially done for you with Flume.
EDIT 3/9: A lot of the details depend on how Flume writes the files. But in general terms, your DDL should look something like this:
CREATE TABLE table_name(fields...) PARTITIONED BY(log_year STRING, log_month STRING, log_day_of_month STRING, log_hour_of_day STRING) format description STORED AS TEXTFILE LOCATION '/your user path/logs';
EDIT 3/15:. In the zzarbi query, I add a note that after creating the table, Hive should be informed about the created partitions. This needs to be done several times while Flume or another process creates new partitions. See My answer to the question Create external with section .
source share