Search code examples
hadoophiveclouderacloudera-cdhimpala

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.


Solution

  • 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.