lightweight
lightweight

Reputation: 3327

writing hive query results to hdfs

I can export a hive query results using this:

INSERT OVERWRITE LOCAL DIRECTORY '/home/user/events/'

but if I want to export it to an HDFS dir at /user/events/

how do I do that? I tried this:

INSERT OVERWRITE DIRECTORY '/user/user/events/'
> row format delimited 
> fields terminated by '\t' 
> select * from table;

but get this error then:

FAILED: ParseException line 2:0 cannot recognize input near 'row' 'format' 'delimited' in statement

Upvotes: 0

Views: 119

Answers (1)

Legato
Legato

Reputation: 1081

remove the LOCAL keyword - it specifies local filesystem. Without it the result will go to hdfs. You may actually need to use OVERWRITE though. So:

INSERT OVERWRITE DIRECTORY '/user/events/'

Upvotes: 1

Related Questions