hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Gates (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-7788) Generate plans for insert, update, and delete
Date Wed, 20 Aug 2014 02:00:22 GMT

     [ https://issues.apache.org/jira/browse/HIVE-7788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alan Gates updated HIVE-7788:
-----------------------------

    Attachment: HIVE-7788.WIP.patch

Attaching a work in progress patch.  This is lacking a couple of things:
* I can't test it end to end until the other patches it depends on are in
* It doesn't generate plans for INSERT...VALUES yet

It incorporates earlier versions of patches for HIVE-7078 and HIVE-7646 which I'll remove
once those are checked in.

The basic approach is as follows:
For tables whose OutputFormat extends AcidOutputFormat, the plan generated for inserts is
changed to remove the stages in the middle that handle merging files.  This is done because
ACID depends on writing delta files, and merging those would break the system.
For updates and deletes, queries are rewritten into inserts...selects.  This works because
that's how updates and deletes are actually implemented underneath. So updates are rewritten
into:
insert into table _tabname_ [partition (_partcols_)] select ROW__ID, _all_cols_, _partcols_
from _tabname_
In the _all_cols_ the expressions from the updates set clause replace those columns specifically
mentioned in the set clause.  All other columns are identity mapped.  For example, given a
table T with columns x and y:
update T set x = 5;
would be rewritten to
insert into table T select 5, y from T;
Delete are rewritten to be
insert into table _tabname_ [partition (_partcols_)] select ROW__ID, _partcols_ from tabname;
For example, 
delete from T;
will be written as
insert into table T select ROW__ID from T;



> Generate plans for insert, update, and delete
> ---------------------------------------------
>
>                 Key: HIVE-7788
>                 URL: https://issues.apache.org/jira/browse/HIVE-7788
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Query Processor
>            Reporter: Alan Gates
>            Assignee: Alan Gates
>         Attachments: HIVE-7788.WIP.patch
>
>
> Insert plans needs to be generated differently for ACID tables, plus we need to be able
to generate plans in the semantic analyzer for update and delete.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message