How to create External Table on Hive from data on local disk instead of HDFS?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 17:25:40

问题


For data on HDFS, we can do

CREATE EXTERNAL TABLE <table>
{
id INT,
name STRING,
age INT 
} LOCATION 'hdfs_path';

But how to specify a local path for the LOCATION above?

Thanks.


回答1:


You can upload the file to HDFS first using "hdfs dfs -put " and then create Hive external table on top of that.

The reason that Hive cannot create external table on local file is because when Hive processes data, the actual processing happens on the Hadoop cluster where your local file may not be accessible at all.




回答2:


I don't think you can create an external table on the local file system. The closest thing would be creating an external table on an AWS S3 bucket, with LOCATION 's3://yourbucket/'



来源:https://stackoverflow.com/questions/31844444/how-to-create-external-table-on-hive-from-data-on-local-disk-instead-of-hdfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!