0
votes

I have a have a hive table which is partitioned with the table_date.I want to get the count of individual partition for the particular day for the particular month and particular year.

When I run the following query I am getting a count for an entire month but I want it as individual day.

select count(*) from table where month(table_date)=1 and year(table _date)=2016
2
Is your table partitioned on table_date or on year(table_date), month(table_date) and day(table_date)? - Gordon Linoff

2 Answers

0
votes

If it is partitioned on date, I would expect this to work:

select table_date, count(*)
from table
where table_date >= '2016-01-01' and table_date < '2016-02-01'
group by table_date;
0
votes
select table_date, count(*)
from table
where table_date between '2016-01-01' and '2016-02-01'
group by table_date;