I don't think that behavior is correct. The rename should create the new partition name in the same location of the table. Could you create a JIRA for that?
On Wed, Mar 22, 2017 at 10:24 AM, Ying Chen <ying.in...@gmail.com> wrote: > cross posting from u...@hive.apache.org. (sorry for additional posting) > I would like some opinions from the dev community relating to - if change > of behavior is desired, how should it be changed ? > Also, would it be better that I create a JIRA and have comments there? > > Thanks much.. > > ------------ > Hello all - > > I was renaming my partition in a table that I've created using the location > clause, and noticed that when after rename is completed, my partition is > moved to the hive warehouse (hive.metastore.warehouse.dir). I was > wondering, what should be the correct behavior? Should the partition be > renamed and maintain on the same file system, or no name change and not > moved (so treating it like if someone declared external table) ? I don't > think it should be moved to hive.metastore.warehouse.dir > > A similar JIRA was open for renaming table: https://issues.apache.org/ > jira/browse/HIVE-14909 > In which, if the table is determined not belonging to /apps/hive/warehouse > (ie created by location clause), then table is not moved. > > Thanks much! > Ying > > ========== > This is a problem for Hive 2.1 ... > > create table test_local_part (col1 int) partitioned by (col2 int) location > '/tmp/testtable/test_local_part'; > insert into test_local_part partition (col2=1) values (1),(3); > insert into test_local_part partition (col2=2) values (3); > alter table test_local_part partition (col2='1') rename to partition > (col2='4'); > > Running: > describe formatted test_local_part partition (col2='2') > > # Detailed Partition Information > Partition Value: [2] > Database: default > Table: test_local_part > CreateTime: Mon Mar 20 13:25:28 PDT 2017 > LastAccessTime: UNKNOWN > Protect Mode: None > Location: > *hdfs://my.server.com:8020/tmp/testtable/test_local_part/col2=2 > <http://my.server.com:8020/tmp/testtable/test_local_part/col2=2>* > > Running: > describe formatted test_local_part partition (col2='4') > > # Detailed Partition Information > Partition Value: [4] > Database: default > Table: test_local_part > CreateTime: Mon Mar 20 13:24:53 PDT 2017 > LastAccessTime: UNKNOWN > Protect Mode: None > Location: > *hdfs://my.server.com:8020/apps/hive/warehouse/test_local_part/col2=4 > <http://my.server.com:8020/apps/hive/warehouse/test_local_part/col2=4> * > Partition Parameters: >