Grokbase Groups Hive commits May 2015
FAQ
Repository: hive
Updated Branches:
   refs/heads/master 129c496bd -> 325a592f5


HIVE-10719: Hive metastore failure when alter table rename is attempted. (Vikram Dixit K, reviewed by Thejas Nair, Sergey Shelukhin)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/325a592f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/325a592f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/325a592f

Branch: refs/heads/master
Commit: 325a592f5f670bef6d6921161ef2d511d21c07d8
Parents: 129c496
Author: vikram <vikram@hortonworks.com>
Authored: Mon May 18 12:46:49 2015 -0700
Committer: vikram <vikram@hortonworks.com>
Committed: Mon May 18 13:52:46 2015 -0700

----------------------------------------------------------------------
  .../hadoop/hive/metastore/HiveAlterHandler.java | 4 +--
  .../clientpositive/alter_change_db_location.q | 5 +++
  .../alter_change_db_location.q.out | 35 ++++++++++++++++++++
  3 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/325a592f/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
index a3f2359..5391171 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
@@ -175,8 +175,8 @@ public class HiveAlterHandler implements AlterHandler {
          // that means user is asking metastore to move data to new location
          // corresponding to the new name
          // get new location
- Path databasePath = constructRenamedPath(
- wh.getDefaultDatabasePath(newt.getDbName()), srcPath);
+ Database db = msdb.getDatabase(newt.getDbName());
+ Path databasePath = constructRenamedPath(wh.getDatabasePath(db), srcPath);
          destPath = new Path(databasePath, newt.getTableName());
          destFs = wh.getFs(destPath);


http://git-wip-us.apache.org/repos/asf/hive/blob/325a592f/ql/src/test/queries/clientpositive/alter_change_db_location.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/alter_change_db_location.q b/ql/src/test/queries/clientpositive/alter_change_db_location.q
new file mode 100644
index 0000000..a74ba2a
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/alter_change_db_location.q
@@ -0,0 +1,5 @@
+create database newDB location "/tmp/";
+describe database extended newDB;
+use newDB;
+create table tab (name string);
+alter table tab rename to newName;

http://git-wip-us.apache.org/repos/asf/hive/blob/325a592f/ql/src/test/results/clientpositive/alter_change_db_location.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/alter_change_db_location.q.out b/ql/src/test/results/clientpositive/alter_change_db_location.q.out
new file mode 100644
index 0000000..64bd680
--- /dev/null
+++ b/ql/src/test/results/clientpositive/alter_change_db_location.q.out
@@ -0,0 +1,35 @@
+#### A masked pattern was here ####
+PREHOOK: type: CREATEDATABASE
+PREHOOK: Output: database:newDB
+#### A masked pattern was here ####
+POSTHOOK: type: CREATEDATABASE
+POSTHOOK: Output: database:newDB
+#### A masked pattern was here ####
+PREHOOK: query: describe database extended newDB
+PREHOOK: type: DESCDATABASE
+POSTHOOK: query: describe database extended newDB
+POSTHOOK: type: DESCDATABASE
+newdb location/in/test hive_test_user USER
+PREHOOK: query: use newDB
+PREHOOK: type: SWITCHDATABASE
+PREHOOK: Input: database:newdb
+POSTHOOK: query: use newDB
+POSTHOOK: type: SWITCHDATABASE
+POSTHOOK: Input: database:newdb
+PREHOOK: query: create table tab (name string)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:newdb
+PREHOOK: Output: newDB@tab
+POSTHOOK: query: create table tab (name string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:newdb
+POSTHOOK: Output: newDB@tab
+PREHOOK: query: alter table tab rename to newName
+PREHOOK: type: ALTERTABLE_RENAME
+PREHOOK: Input: newdb@tab
+PREHOOK: Output: newdb@tab
+POSTHOOK: query: alter table tab rename to newName
+POSTHOOK: type: ALTERTABLE_RENAME
+POSTHOOK: Input: newdb@tab
+POSTHOOK: Output: newDB@newName
+POSTHOOK: Output: newdb@tab

Search Discussions

  • Vikram at May 18, 2015 at 9:01 pm
    Repository: hive
    Updated Branches:
       refs/heads/branch-1.2 8fece5b4a -> 6644ae3d2


    HIVE-10719: Hive metastore failure when alter table rename is attempted. (Vikram Dixit K, reviewed by Thejas Nair, Sergey Shelukhin)


    Project: http://git-wip-us.apache.org/repos/asf/hive/repo
    Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/6644ae3d
    Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/6644ae3d
    Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/6644ae3d

    Branch: refs/heads/branch-1.2
    Commit: 6644ae3d2b42c3622197f876a10e536241c82ee4
    Parents: 8fece5b
    Author: vikram <vikram@hortonworks.com>
    Authored: Mon May 18 13:56:15 2015 -0700
    Committer: vikram <vikram@hortonworks.com>
    Committed: Mon May 18 13:56:15 2015 -0700

    ----------------------------------------------------------------------
      .../hadoop/hive/metastore/HiveAlterHandler.java | 4 +--
      .../clientpositive/alter_change_db_location.q | 5 +++
      .../alter_change_db_location.q.out | 35 ++++++++++++++++++++
      3 files changed, 42 insertions(+), 2 deletions(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/hive/blob/6644ae3d/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
    ----------------------------------------------------------------------
    diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
    index 50ec1e8..d0351da 100644
    --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
    +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
    @@ -174,8 +174,8 @@ public class HiveAlterHandler implements AlterHandler {
              // that means user is asking metastore to move data to new location
              // corresponding to the new name
              // get new location
    - Path databasePath = constructRenamedPath(
    - wh.getDefaultDatabasePath(newt.getDbName()), srcPath);
    + Database db = msdb.getDatabase(newt.getDbName());
    + Path databasePath = constructRenamedPath(wh.getDatabasePath(db), srcPath);
              destPath = new Path(databasePath, newt.getTableName());
              destFs = wh.getFs(destPath);


    http://git-wip-us.apache.org/repos/asf/hive/blob/6644ae3d/ql/src/test/queries/clientpositive/alter_change_db_location.q
    ----------------------------------------------------------------------
    diff --git a/ql/src/test/queries/clientpositive/alter_change_db_location.q b/ql/src/test/queries/clientpositive/alter_change_db_location.q
    new file mode 100644
    index 0000000..a74ba2a
    --- /dev/null
    +++ b/ql/src/test/queries/clientpositive/alter_change_db_location.q
    @@ -0,0 +1,5 @@
    +create database newDB location "/tmp/";
    +describe database extended newDB;
    +use newDB;
    +create table tab (name string);
    +alter table tab rename to newName;

    http://git-wip-us.apache.org/repos/asf/hive/blob/6644ae3d/ql/src/test/results/clientpositive/alter_change_db_location.q.out
    ----------------------------------------------------------------------
    diff --git a/ql/src/test/results/clientpositive/alter_change_db_location.q.out b/ql/src/test/results/clientpositive/alter_change_db_location.q.out
    new file mode 100644
    index 0000000..64bd680
    --- /dev/null
    +++ b/ql/src/test/results/clientpositive/alter_change_db_location.q.out
    @@ -0,0 +1,35 @@
    +#### A masked pattern was here ####
    +PREHOOK: type: CREATEDATABASE
    +PREHOOK: Output: database:newDB
    +#### A masked pattern was here ####
    +POSTHOOK: type: CREATEDATABASE
    +POSTHOOK: Output: database:newDB
    +#### A masked pattern was here ####
    +PREHOOK: query: describe database extended newDB
    +PREHOOK: type: DESCDATABASE
    +POSTHOOK: query: describe database extended newDB
    +POSTHOOK: type: DESCDATABASE
    +newdb location/in/test hive_test_user USER
    +PREHOOK: query: use newDB
    +PREHOOK: type: SWITCHDATABASE
    +PREHOOK: Input: database:newdb
    +POSTHOOK: query: use newDB
    +POSTHOOK: type: SWITCHDATABASE
    +POSTHOOK: Input: database:newdb
    +PREHOOK: query: create table tab (name string)
    +PREHOOK: type: CREATETABLE
    +PREHOOK: Output: database:newdb
    +PREHOOK: Output: newDB@tab
    +POSTHOOK: query: create table tab (name string)
    +POSTHOOK: type: CREATETABLE
    +POSTHOOK: Output: database:newdb
    +POSTHOOK: Output: newDB@tab
    +PREHOOK: query: alter table tab rename to newName
    +PREHOOK: type: ALTERTABLE_RENAME
    +PREHOOK: Input: newdb@tab
    +PREHOOK: Output: newdb@tab
    +POSTHOOK: query: alter table tab rename to newName
    +POSTHOOK: type: ALTERTABLE_RENAME
    +POSTHOOK: Input: newdb@tab
    +POSTHOOK: Output: newDB@newName
    +POSTHOOK: Output: newdb@tab

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedMay 18, '15 at 8:53p
activeMay 18, '15 at 9:01p
posts2
users1
websitehive.apache.org

1 user in discussion

Vikram: 2 posts

People

Translate

site design / logo © 2021 Grokbase