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

Alan Gates commented on HIVE-7090:
----------------------------------

Rolling back doesn't actually change any data.  What is does is mark a 
transaction id as aborted.  Then readers know to ignore records from that 
transaction id.  So consider the following scenario:

begin session
begin transaction 1 
write to temp table
commit
begin transaction 2
write more to temp table
rollback
read temp table

The read will know to disregard all records marked with transaction id 2 (this 
holds whether the table is temporary or not) and thus will only return records 
from the first write.


> Support session-level temporary tables in Hive
> ----------------------------------------------
>
>                 Key: HIVE-7090
>                 URL: https://issues.apache.org/jira/browse/HIVE-7090
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Gunther Hagleitner
>            Assignee: Jason Dere
>         Attachments: HIVE-7090.1.patch, HIVE-7090.2.patch, HIVE-7090.3.patch, 
> HIVE-7090.4.patch, HIVE-7090.5.patch, HIVE-7090.6.patch, HIVE-7090.7.patch
>
>
> It's common to see sql scripts that create some temporary table as an 
> intermediate result, run some additional queries against it and then clean up 
> at the end.
> We should support temporary tables properly, meaning automatically manage the 
> life cycle and make sure the visibility is restricted to the creating 
> connection/session. Without these it's common to see left over tables in 
> meta-store or weird errors with clashing tmp table names.
> Proposed syntax:
> CREATE TEMPORARY TABLE ....
> CTAS, CTL, INSERT INTO, should all be supported as usual.
> Knowing that a user wants a temp table can enable us to further optimize 
> access to it. E.g.: temp tables should be kept in memory where possible, 
> compactions and merging table files aren't required, ...



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

Reply via email to