1
votes

I have already an internal table in hive. Now I want to create an external table with partitions based on date to it. But it throws error, when I try to create it.

Sample code:

create external table db_1.T_DATA1 partitioned by (date string) as select * from db_2.temp
LOCATION 'file path';

Error:

ParseException line 2:0 cannot recognize input near 'LOCATION' ''file path'' '' in table source

1
I don't believe you can create an external table using create table as select. Just create the table normally, and insert your data. - Andrew
Ok. Thanks for the response. I have created the table manually. - Vishnu

1 Answers

1
votes

As per the answer provided at https://stackoverflow.com/a/26722320/4326922 you should be able to create external table with CTAS.