Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
like image 955
user1309258 Avatar asked Apr 28 '26 00:04

user1309258


1 Answers

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.

like image 54
Abimaran Kugathasan Avatar answered May 01 '26 08:05

Abimaran Kugathasan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!