The name of the directory within your Hive Warehouse location is the table Name.
For example, if you create a table testTable
in Hive, correspondingly a directory with the same name is created within the Hive warehouse Directory.
Further, if you create partitions on your Hive table, each partition will map to a sub-directory within your testTable
directory, i.e <hive_warehouse_path>/testTable/<partition>
. All data under a particular partition are stored in files under the partition sub-directory. This is the way hive manages its data on HDFS. Of course, it stores the table schema on the Metastore, but the actual data is stored as above in HDFS.
In your question, you indicated that you want to get the table name of the HDFS location hdfs://xyz.com:8020/user/hive/warehouse/test
. In this case the table name should be test
.
There is also the possibility that /user/hive/warehouse
, which is the default warehouse location that hive uses to store table data & is defined in hive-default.xml
might have been overridden & hive might actually be using a different location for its warehouse. You should check hive-site.xml
on your environment to be certain of the hive metastore location.