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

Roja B commented on HIVE-12604:
-------------------------------

I had faced a similar issue:

My scenario was:
1) create table test.temp_A 2) check if index exists and delete 3) create index 
4) check if table test1.A exists and drop 5) Rename table test.temp_A to test1.A
Everysingle time the drop table(step 4) was failing by throwing the error the 
schema.Temp_A_index does not exist.
Solution :
I have renamed the table A to B. And have dropped test. B and test1.B and Which 
enabled to drop test1. A.

Also changed the sequence of my script to
1) create table temp_A in test2) check if table A exists and drop 3) Rename 
test.temp_A to test1.A 4) check if index exists and drop 5) create index

Always check your hdfs location and know look for the the relevant tables and 
schema names that got created with index.

Use command : hdfs dfs -rm -r /path to hdfs location/relevant filename.

This resolved my Problem.


> Cannot drop a table after creating an index and then renaming to a different 
> database
> -------------------------------------------------------------------------------------
>
>                 Key: HIVE-12604
>                 URL: https://issues.apache.org/jira/browse/HIVE-12604
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>         Environment: Hortonworks Sandbox VM with HDP 2.3
>            Reporter: Toby Allsopp
>            Priority: Minor
>
> {noformat}
> Connected to: Apache Hive (version 1.2.1.2.3.0.0-2557)
> Driver: Hive JDBC (version 1.2.1.2.3.0.0-2557)
> 0: jdbc:hive2://localhost:10000> create database db1;
> No rows affected (0.997 seconds)
> 0: jdbc:hive2://localhost:10000> create database db2;
> No rows affected (0.968 seconds)
> 0: jdbc:hive2://localhost:10000> create table db1.test (col1 int);
> No rows affected (1.758 seconds)
> 0: jdbc:hive2://localhost:10000> create index idx1 on table db1.test(col1) as 
> 'compact' with deferred rebuild;
> No rows affected (0.287 seconds)
> 0: jdbc:hive2://localhost:10000> alter index idx1 on db1.test rebuild;
> INFO  : Tez session hasn't been created yet. Opening session
> INFO  :
> INFO  : Status: Running (Executing on YARN cluster with App id 
> application_1449025977131_0007)
> INFO  : Map 1: -/-      Reducer 2: 0/1
> INFO  : Map 1: -/-      Reducer 2: 0(+1)/1
> INFO  : Map 1: -/-      Reducer 2: 0/1
> INFO  : Map 1: -/-      Reducer 2: 1/1
> INFO  : Loading data to table db1.db1__test_idx1__ from 
> hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/db1.db/b1__test_idx1__/.hive-staging_hive_2015-12-04_02-02-47_278_3621654884902999047-10/-ext-10000
> INFO  : Table db1.db1__test_idx1__ stats: [numFiles=1, numRows=0, 
> totalSize=0, rawDataSize=0]
> No rows affected (7.792 seconds)
> 0: jdbc:hive2://localhost:10000> alter table db1.test rename to db2.test;
> No rows affected (0.261 seconds)
> 0: jdbc:hive2://localhost:10000> drop table db2.test;
> Error: Error while processing statement: FAILED: Execution Error, return code 
> 1 from org.apache.hadoop.hive.ql.exec.DDLask. 
> MetaException(message:db2.db1__test_idx1__ table not found) 
> (state=08S01,code=1)
> {noformat}
> Basically it looks like the rename to a different database left the index 
> table in the old database.



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

Reply via email to