hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From St├ęphane Verlet <kaweahsoluti...@gmail.com>
Subject Re: Insert into partitioned table from unpartitioned table
Date Mon, 22 Dec 2014 22:37:01 GMT
Specify the cols with the partition cols last in the select statement

INSERT OVERWRITE TABLE dest_table PARTITION (year, month, day)
SELECT

field1 ,
field2,
...
year,
month,
day

FROM source_table

On Mon, Dec 22, 2014 at 12:07 PM, Buntu Dev <buntudev@gmail.com> wrote:

> Hi -- I got the destination table with partition on columns that are not
> in the source table and get this error when attempting to do an INSERT
> OVERWRITE, how to go about fixing this? Thanks:
>
>
> SET hive.exec.dynamic.partition = true;
> SET hive.exec.dynamic.partition.mode = nonstrict;
> INSERT OVERWRITE TABLE dest_table PARTITION (year, month, day)
> SELECT *
> FROM source_table
>
> Cannot insert into target table because column number/types are different
> 'day': Table insclause-0 has 42 columns, but query has 39 columns.
>
>

Mime
View raw message