hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HIVE-936) dynamic partitions creation based on values
Date Mon, 21 Dec 2009 19:19:18 GMT

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

Zheng Shao commented on HIVE-936:
---------------------------------

Another case not covered by previous discussions (copied from HIVE-1002):

{code}
CREATE TABLE (a STRING, b STRING, c STRING)
PARTITIONED BY (ds STRING, ts STRING);

INSERT OVERWRITE TABLE x PARTITION (ds = '2009-12-12')
SELECT a, b, c, ts FROM xxx;
{code}

Basically, allowing users to overwrite multiple partitions at a time.
The partition values specified in PARTITION part (if any) should be a prefix of the partition
keys (to simply implementation).
The rest of the partition keys goes to the end of the SELECT expression list.

This query will remove any existing partitions of ds = '2009-12-12' (and any ts value), and
create partitions with ds = '2009-12-12' and ts of dynamical values.



> dynamic partitions creation based on values
> -------------------------------------------
>
>                 Key: HIVE-936
>                 URL: https://issues.apache.org/jira/browse/HIVE-936
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Ning Zhang
>            Assignee: Ning Zhang
>
> If a Hive table is created as partitioned, DML could only inserted into one partitioin
per query. Ideally partitions should be created on the fly based on the value of the partition
columns. As an example:
> {{{
>   create table T (a int, b string) partitioned by (ds string);
>   insert overwrite table T select a, b, ds from S where ds >= '2009-11-01' and ds
<= '2009-11-16';
> }}}
> should be able to execute in one DML rather than possibley 16 DML for each distinct ds
values. CTAS and alter table should be able to do the same thing:
> {{{
>   create table T partitioned by (ds string) as select * from S where ds >= '2009-11-01'
and ds <= '2009-11-16';
> }}}
>  and
> {{{
>   create table T(a int, b string, ds string);
>   insert overwrite table T select * from S where ds >= '2009-11-1' and ds <= '2009-11-16';
>   alter table T partitioned by (ds);
> }}}
> should all return the same results.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message