You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Gabor Kaszab (JIRA)" <ji...@apache.org> on 2018/05/28 11:54:00 UTC

[jira] [Created] (IMPALA-7084) Partition doesn't exist after attempting to ALTER partition location to non-existing path

Gabor Kaszab created IMPALA-7084:
------------------------------------

             Summary: Partition doesn't exist after attempting to ALTER partition location to non-existing path
                 Key: IMPALA-7084
                 URL: https://issues.apache.org/jira/browse/IMPALA-7084
             Project: IMPALA
          Issue Type: Bug
          Components: Catalog
    Affects Versions: Impala 2.12.0
            Reporter: Gabor Kaszab


 

 
{code:java}
create table test (a int) partitioned by (b int);
insert into test partition (b=1) values (1);

// create another partition that points to a different location.
alter table test add partition (b=2) location 'hdfs://localhost:20500/test-warehouse/test/b=2/';

// setting the first partition to a non existing location. This fails as expected.
alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=5/';
Query: alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=5/'
ERROR: TableLoadingException: Failed to load metadata for table: default.test
CAUSED BY: NullPointerException: null

// Setting the first parameter to an existing location. This surprisingly fails the partitions doesn't exist.
alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=2/';
Query: alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=1/'
ERROR: PartitionNotFoundException: Partition not found: TPartitionKeyValue(name:b, value:1)

// However show partition displays b=1 partition.
show partitions test;
Query: show partitions test
+-------+-------+--------+------+--------------+-------------------+--------+-------------------+------------------------------------------------+
| b | #Rows | #Files | Size | Bytes Cached | Cache Replication | Format | Incremental stats | Location |
+-------+-------+--------+------+--------------+-------------------+--------+-------------------+------------------------------------------------+
| 1 | -1 | 1 | 2B | NOT CACHED | NOT CACHED | TEXT | false | hdfs://localhost:20500/test-warehouse/test/b=1 |
| 2 | -1 | 1 | 2B | NOT CACHED | NOT CACHED | TEXT | false | hdfs://localhost:20500/test-warehouse/test/b=2 |
| Total | -1 | 2 | 4B | 0B | | | | |
+-------+-------+--------+------+--------------+-------------------+--------+-------------------+------------------------------------------------+

// Invalidate metadata fixes this issue
invalidate metadata test;

alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=2/';
Query: alter table test partition (b=1) set location 'hdfs://localhost:20500/test-warehouse/test/b=2/'
+--------------------------------------------------------+
| summary |
+--------------------------------------------------------+
| New location has been set for the specified partition. |
+--------------------------------------------------------+


{code}
 

My expectation here would be that in case the first alter partition location command fails due to non-existing location then no state change should be done in the background. In addition seeing an existing partition as a non-existing one after a failed attempt to change some metadata is also undesired.

 



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