There is a "Results" table which contains Id and Date columns.
create table Results(Id int, Date String)
row format delimited fields terminated by ','
stored as textfile;
Id Date
11 2012-04-06
12 2012-05-08
13 2013-02-10
14 2013-05-06
15 2013-08-22
16 2014-04-01
17 2014-05-06
18 2014-06-03
19 2014-07-24
20 2014-08-26
How to store the above data into "Historical" table by dynamically partitioning based on year and week no from the above date column.
In the Historical table it should contain partitions based on year & week, output must be
Historical partition
2012 partition contains 2 partitions
2013 partition contains 3 partitions
2014 partition contains 5 partitions