2017-03-21 4 views
0

Ich habe eine Hive-Tabelle, die mit dem Table_Date partitioniert ist. Ich möchte die Anzahl der einzelnen Partition für den jeweiligen Tag für den jeweiligen Monat und bestimmten Jahr erhalten.Zählen Sie auf bestimmten Partitionen für bestimmte Monate im Bienenstock

Wenn ich die folgende Abfrage ausführen bekomme ich eine Zählung für einen ganzen Monat, aber ich will es als einzelner Tag.

select count(*) from table where month(table_date)=1 and year(table _date)=2016 
+0

Ist Ihre Tabelle partitioniert auf 'table_date' oder auf' Jahr (table_date) ',' Monat (table_date) 'und' day (table_date) '? –

Antwort

0

Wenn es auf Datum partitioniert ist, würde ich erwarten, dies funktioniert:

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