Osiris
Osiris

Reputation: 1027

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

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.

Upvotes: 2

Views: 3862

Answers (2)

Zheng Shao
Zheng Shao

Reputation: 121

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.

Upvotes: 3

maxymoo
maxymoo

Reputation: 36545

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/'

Upvotes: 0

Related Questions