user1309258
user1309258

Reputation: 89

Querying multiple partitions hive?

How can I query multiple partitions of the same table in Hive? In the same command?

Something like ???

SELECT * FROM mytable WHERE partition ='first_partition' and partition='second_partition'

Upvotes: 3

Views: 10473

Answers (1)

Abimaran Kugathasan
Abimaran Kugathasan

Reputation: 32458

In Hive, partition is also a column, so in a query perspective, there is no difference. You can think it as a column.

if table page_views is partitioned on column date, the following query retrieves rows for just days between 2008-03-01 and 2008-03-31.

SELECT page_views.*
FROM page_views
WHERE page_views.date >= '2008-03-01' AND page_views.date <= '2008-03-31'

In your case, you can use like

SELECT * FROM mytable WHERE column_one ='first_partition' and column_two ='second_partition'

It will be more clear, if you give the table structure.

Upvotes: 9

Related Questions