LOCATION in Hive

2019-08-24 15:08发布

While creating hive tables, Can I point the 'LOCATION' to a place in hdfs where data is present. Do I still need to load data or Will the data be available on hive directly?

标签: hive hdfs
1条回答
贪生不怕死
2楼-- · 2019-08-24 15:52

You can specify any location while creating table and the data will be accessible. If table is partitioned, then use ALTER TABLE ADD PARTITION or MSCK REPAIR TABLE table_name or Amazon version ALTER TABLE table_name RECOVER PARTITIONS , this will add any partitions that exist on HDFS but not in metastore to the metastore. See docs here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-RecoverPartitions(MSCKREPAIRTABLE)

If table is not partitioned, you can simply specify the location with data while creating table or change table location using ALTER TABLE SET LOCATION.

查看更多
登录 后发表回答