hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carter Shanklin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-16300) Allow to specify target table columns in static partition insert
Date Mon, 27 Mar 2017 00:36:42 GMT

    [ https://issues.apache.org/jira/browse/HIVE-16300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15942502#comment-15942502
] 

Carter Shanklin commented on HIVE-16300:
----------------------------------------

IMO Hive should implement standard "insert column list" support as defined in the SQL spec

This would allow:

insert into x (col1, col3, col2, pcol) select c1, c3, c2, partition_key from staging;

Or if you wanted to write to a single partition:

insert into x (col1, col3, col2, pcol) select c1, c3, c2, '2017-01-01' from staging;

Or even:

insert into x (pcol, col3, col2, pcol) select '2017-01-01', c1, c3, c2 from staging;

In other words there is nothing special about the partition column(s) with respect to INSERT/UPDATE/DELETE/MERGE.

> Allow to specify target table columns in static partition insert
> ----------------------------------------------------------------
>
>                 Key: HIVE-16300
>                 URL: https://issues.apache.org/jira/browse/HIVE-16300
>             Project: Hive
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.1.1
>            Reporter: Kostyantyn Oliynyk
>            Assignee: Kostyantyn Oliynyk
>            Priority: Trivial
>
> It is not possible to specify target table columns in static partition insert.
> As a result SQL parser will throw an error if fields from sub select does not match target
table fields.
> For example for the following table
> CREATE TABLE my_table(col1 STRING, col2 STRING, col3 STRING) PARTITIONED BY (pcol STRING);
> following insert will failed due to different number of fields in select and in target
table:
> INSERT OVERWRITE TABLE my_table
> PARTITION(pcol='TEST')
> SELECT 'A' as a, 'B'as b;
> Proposed change adds support for the following syntax:
> INSERT OVERWRITE TABLE my_table
> PARTITION(pcol='TEST')
> *(col1, col3)*
> SELECT 'A' as a, 'B'as b;
> Issue is marked with Trivial priority as it has workaround such as using dynamic partition
insert. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message