Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have created a table in hive, I would like to know which directory my table is created in?

Tags:

hive

hiveql

I have created a table in hive, I would like to know which directory my table is created in? I would like to know the path...

like image 694
Muneer Basha Syed Avatar asked Nov 01 '12 13:11

Muneer Basha Syed


People also ask

How do I find the location of the table in hive?

in hive 0.1 you can use SHOW CREATE TABLE to find the path where hive store data. in other versions, there is no good way to do this. use DESCRIBE FORMATTED <table> to show table information.

How do I change the location of an internal table in hive?

An internal table is stored on HDFS in the /user/hive/warehouse directory which is its default storage location. This location can be changed by updating the path in the configuration file present in the config file – hive. metastore. warehouse.

Which command is used to create a table which points to an existing directory in hive?

The general syntax for creating a table in Hive is: CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.] table_name (col_name data_type [COMMENT 'col_comment'],, ...) [COMMENT 'table_comment'] [ROW FORMAT row_format] [FIELDS TERMINATED BY char] [STORED AS file_format];

How can you tell if a table is internal or external in hive?

We can identify the internal or External tables using the DESCRIBE FORMATTED table_name statement in the Hive, which will display either MANAGED_TABLE or EXTERNAL_TABLE depending on the table type.


2 Answers

DESCRIBE FORMATTED my_table;

or

DESCRIBE FORMATTED my_table PARTITION (my_column='my_value');

like image 187
Joe K Avatar answered Oct 08 '22 16:10

Joe K


There are three ways to describe a table in Hive.

1) To see table primary info of Hive table, use describe table_name; command

2) To see more detailed information about the table, use describe extended table_name; command

3) To see code in a clean manner use describe formatted table_name; command to see all information. also describe all details in a clean manner.

Resource: Hive interview tips

like image 22
Venu A Positive Avatar answered Oct 08 '22 16:10

Venu A Positive