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

Zoltan Haindrich commented on HIVE-24920:
-----------------------------------------

if we are about to do that then an existing external table dir might cause some 
trouble:
{code}
create external table t (i integer);
-- this will create dir WH/t
insert into t values (1);
drop table t;
-- this will leave WH/t as is beacuse its a full external table without the 
purge option
create table t(i integer);
-- this will create a table at the same external location; which is now 
occupied...your current proposal doesn't handle this case
select * from t
1
-- shows the inserted record from the previous table instance...
{code}

I don't think we should just accept the above behaviour the user have used a 
statement which should have created a normal managed table (create table t) - 
so it should be empty in any circumstances....if we ant to do the same kind of 
renames for translated table we should still retain the "existing location dir" 
avoidance mechanisms of the existing patch - and set the one which throws an 
exception if it exists the default.

This could probably enable our users to choose the behaviour they would like to 
see.

[~thejas]: what do you think?

> TRANSLATED_TO_EXTERNAL tables may write to the same location
> ------------------------------------------------------------
>
>                 Key: HIVE-24920
>                 URL: https://issues.apache.org/jira/browse/HIVE-24920
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> {code}
> create table t (a integer);
> insert into t values(1);
> alter table t rename to t2;
> create table t (a integer); -- I expected an exception from this command 
> (location already exists) but because its an external table no exception
> insert into t values(2);
> select * from t;  -- shows 1 and 2
> drop table t2;    -- wipes out data location
> select * from t;  -- empty resultset
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to