Create table as select in supported in Hive 0.4 release. It is a new feature in 
0.5

-----Original Message-----
From: E. Sammer [mailto:[email protected]] 
Sent: Friday, February 12, 2010 4:41 PM
To: [email protected]
Subject: Create table as select

The Hive wiki states the following for the CREATE TABLE ... DDL:

"AS select_statement]  (Note: this feature is only available on the 
latest trunk or versions higher than 0.4.0.)"

I'm testing this syntax on 0.4.0(+14 - Cloudera distro) and I'm getting 
errors from the query parser at the second occurrence of 'as' for the 
select portion.

hive> describe raw_facts;
OK
year    int
month   int
day     int
... other fields...
Time taken: 0.339 seconds

hive> create table foo row format delimited fields terminated by '\t' 
stored as textfile as select year, month from raw_facts limit 20 ;
FAILED: Parse Error: line 1:83 mismatched input 'as' expecting EOF

I've tried other variations such as without the stored as clause and all 
uppercase but receive the same error. Is this incorrect usage on my part 
or is the CTAS syntax versions higher than 0.4.0, exclusive?

Thanks in advance.
-- 
Eric Sammer
[email protected]
http://esammer.blogspot.com

Reply via email to