1

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

leftjoin
  • 36,950
  • 8
  • 57
  • 116
Vishnu
  • 11
  • 6
  • 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 Dec 21 '18 at 05:10
  • Ok. Thanks for the response. I have created the table manually. – Vishnu Dec 21 '18 at 06:24

1 Answers1

1

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

Prabhakar Reddy
  • 4,628
  • 18
  • 36