That looks like a bug in rename. Can you please file a JIRA?

From: Toby Allsopp 
<toby.alls...@wherescape.com<mailto:toby.alls...@wherescape.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Thursday, December 3, 2015 at 18:24
To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Subject: Cannot drop a table after creating an index and then renaming to a 
different database

Hi, a sequence of commands should make things clearer. I'm using the 
Hortonworks Sandbox VM with HDP 2.3.

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<http://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)

Basically it looks like the rename to a different database left the index table 
in the old database.

Is this a known issue? Should I be dropping the indexes before renaming tables 
to different databases?

Cheers,
Toby.

Reply via email to