Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

External table in hive

Highlighted

External table in hive

New Contributor

Hi ,

 

Suppose i am having two file is same directory in hdfs ,  and i am creating an external table in hive

which file should we dynamically loaded into external table ?

 

for e.x

 

create external table ext_example (col1 string, col2 int)

row format delimited fields terminated..............

location '/datalake/source/dir/

 

 

and under this location in hdfs having two files :

 

/datalake/source/dir/file1

'/datalake/source/dir/file2

 

which file it should loaded??

 

 

1 REPLY 1
Highlighted

Re: External table in hive

Master Collaborator

External table should be 1 file per directory unless you are using deeper folders for partitions.

 

You can find more info and an example here:

 

CREATE EXTERNAL TABLE test (id BIGINT) PARTITIONED BY ( yymmdd STRING);
ALTER TABLE test ADD PARTITION (yymmdd = '20120921') LOCATION 'loc1';
ALTER TABLE test ADD PARTITION (yymmdd = '20120922') LOCATION 'loc2';

https://stackoverflow.com/questions/9039414/hive-table-creation-with-multi-files-with-multiple-direc...

Don't have an account?
Coming from Hortonworks? Activate your account here