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

Oleksiy Sayankin commented on HIVE-16950:
-----------------------------------------

Hi all.

 

Let's discuss some ideas about this issue. When I have implemented verification 
for tables (check if table folder exists before creation of a table, and if yes 
- throw an exception), I have faced some problems here:
 # SemanticAnalyzer uses temp tables placed in one folder, so it starts to fail 
in INSERT operations.
 # Customers may want to create external tables with existing data/folders to 
escape from data copying.

 

So I  have added two exceptions: temporary and external tables may use the same 
folder. Even in that case I have some tests failed (e.g.

org.apache.hive.hcatalog.api.repl.commands.TestCommands.testBasicReplEximCommands).
 Import command does not work with the fix for tables:

 
{code:java}
hive> export table student to '/user/mysudent';
hive> import table imported_student from '/user/mysudent';
{code}
results with
{code:java}
FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. InvalidObjectException(message:Failed 
to create table. Table directory already exists
{code}
So my suggestion is to implement fix for databases but not for the tables. Any 
ideas?

 

> Dropping hive database/table which was created explicitly in default database 
> location, deletes all databases data from default database location
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-16950
>                 URL: https://issues.apache.org/jira/browse/HIVE-16950
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.2.1
>            Reporter: Rahul Kalgunde
>            Assignee: Oleksiy Sayankin
>            Priority: Minor
>         Attachments: HIVE-16950.1.patch, HIVE-16950.2.patch
>
>
> When database/table is created explicitly pointing to the default location, 
> dropping the database/table deletes all the data associated with the all 
> databases/tables.
> Steps to replicate: 
> in below e.g. dropping table test_db2 also deletes data of test_db1 where as 
> metastore still contains test_db1
> hive> create database test_db1;
> OK
> Time taken: 4.858 seconds
> hive> describe database test_db1;
> OK
> test_db1                
> hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/test_db1.db     root  
>   USER
> Time taken: 0.599 seconds, Fetched: 1 row(s)
> hive> create database test_db2 location '/apps/hive/warehouse' ;
> OK
> Time taken: 1.457 seconds
> hive> describe database test_db2;
> OK
> test_db2                
> hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse root    USER
> Time taken: 0.582 seconds, Fetched: 1 row(s)
> hive> drop database test_db2;
> OK
> Time taken: 1.317 seconds
> hive> dfs -ls /apps/hive/warehouse;
> ls: `/apps/hive/warehouse': No such file or directory
> Command failed with exit code = 1
> Query returned non-zero code: 1, cause: null
> hive> describe database test_db1;
> OK
> test_db1                
> hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/test_db1.db     root  
>   USER
> Time taken: 0.629 seconds, Fetched: 1 row(s)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to