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...
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.
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.
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];
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.
DESCRIBE FORMATTED my_table;
or
DESCRIBE FORMATTED my_table PARTITION (my_column='my_value');
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With