Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know location about partition in hive?

Tags:

If I write a hive sql like

ALTER TABLE tbl_name ADD PARTITION (dt=20131023) LOCATION 'hdfs://path/to/tbl_name/dt=20131023; 

How can I query this location about partition later? Because I found there is some data in location but I can't query them, hive sql like

SELECT data FROM tbl_name where dt=20131023; 
like image 467
MoreFreeze Avatar asked Oct 24 '13 03:10

MoreFreeze


People also ask

How do I find the partition path in Hive?

Show All Partitions on Hive Table. After loading the data into the Hive partition table, you can use SHOW PARTITIONS command to see all partitions that are present. Alternatively, if you know the Hive store location on the HDFS for your table, you can run the HDFS command to check the partitions.

Where is partitioning and bucketing in Hive?

Hive partition creates a separate directory for a column(s) value. Bucketing decomposes data into more manageable or equal parts. With partitioning, there is a possibility that you can create multiple small partitions based on column values.

What is location in Hive table creation?

The table in the hive is consists of multiple columns and records. The table we create in any database will be stored in the sub-directory of that database. The default location where the database is stored on HDFS is /user/hive/warehouse.


1 Answers

Do a describe on the partition instead of the full table.
This will show the linked location if it's an external table.

describe formatted tbl_name partition (dt='20131023') 
like image 71
SamirK Avatar answered Sep 21 '22 22:09

SamirK