hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nishant Kelkar <nishant....@gmail.com>
Subject Re: CREATE (PARTITIONED) TABLE AS error
Date Wed, 05 Nov 2014 17:47:32 GMT
The following worked for me:

> CREATE TABLE dropme(key int, value string) PARTITIONED BY (yr int, mth
int);

> SET hive.exec.dynamic.partition.mode=nonstrict

> INSERT INTO TABLE dropme PARTITION(yr,mth)
SELECT stack(1,
2, 'val', 2014, 5) AS
(key, value, yr, mth) FROM singlerow;

Note that you need the second SET command to allow for dynamic partitioning
over all partition fields. "stack" is a in-built UDTF that takes in as
first argument, the number of rows to insert N (in this case N=1) followed
by "NK" arguments, where K is the number of columns you have.


Best Regards,
Nishant Kelkar

On Wed, Nov 5, 2014 at 9:29 AM, Maciek <maciek@sonra.io> wrote:

> Based on the documentation
> https://cwiki.apache.org/confluence/display/Hive/DynamicPartitions
> the following CTAS should work:
>
> CREATE TABLE dropme(key int, value string) PARTITIONED BY (yr int, mth
> int) AS
> SELECT 2 key, 'val' value, 2014 yr, 5 mth FROM singlerow;
>
> but instead it gives me the error:
>
> FAILED: SemanticException [Error 10065]: CREATE TABLE AS SELECT command
> cannot specify the list of columns for the target table
> Any ideas what is wrong here?
> PS. I'm on hive 0.13 but the releavant documentation entry is dated so it
> should be supported in 0.13 I supposeā€¦
>

Mime
View raw message