atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject incubator-atlas git commit: ATLAS-929 Add test for trait preservation on column rename for non-default database (svimal2106 via shwethags)
Date Tue, 21 Jun 2016 10:33:54 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.7-incubating a703a453b -> 7ae184e0a


ATLAS-929 Add test for trait preservation on column rename for non-default database (svimal2106
via shwethags)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/7ae184e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/7ae184e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/7ae184e0

Branch: refs/heads/0.7-incubating
Commit: 7ae184e0ac095d35c59243b420f9dbcd92f05653
Parents: a703a45
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Tue Jun 21 16:01:57 2016 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Tue Jun 21 16:01:57 2016 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/atlas/hive/hook/HiveHook.java  | 5 ++++-
 .../test/java/org/apache/atlas/hive/hook/HiveHookIT.java    | 9 ++++++---
 release-log.txt                                             | 1 +
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7ae184e0/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
index 664ef62..46af653 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
@@ -333,9 +333,12 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext
{
     private void renameColumn(HiveMetaStoreBridge dgiBridge, HiveEventContext event) throws
 Exception{
         assert event.getInputs() != null && event.getInputs().size() == 1;
         assert event.getOutputs() != null && event.getOutputs().size() > 0;
+
         Table oldTable = event.getInputs().iterator().next().getTable();
         List<FieldSchema> oldColList = oldTable.getAllCols();
-        List<FieldSchema> newColList = dgiBridge.hiveClient.getTable(event.getOutputs().iterator().next().getTable().getTableName()).getAllCols();
+        Table outputTbl = event.getOutputs().iterator().next().getTable();
+        outputTbl = dgiBridge.hiveClient.getTable(outputTbl.getDbName(), outputTbl.getTableName());
+        List<FieldSchema> newColList = outputTbl.getAllCols();
         assert oldColList.size() == newColList.size();
 
         Pair<String, String> changedColNamePair = findChangedColNames(oldColList, newColList);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7ae184e0/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
index 995562e..4afdb27 100755
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
@@ -1023,13 +1023,16 @@ public class HiveHookIT {
 
     @Test
     public void testTraitsPreservedOnColumnRename() throws Exception {
-        String tableName = createTable();
-        String tbqn = HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, DEFAULT_DB,
tableName);
+        String dbName = createDatabase();
+        String tableName = tableName();
+        String createQuery = String.format("create table %s.%s (id int, name string)", dbName,
tableName);
+        runCommand(createQuery);
+        String tbqn = HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, dbName, tableName);
         String guid = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn,
"id"));
         String trait = createTrait(guid);
         String oldColName = "id";
         String newColName = "id_new";
-        String query = String.format("alter table %s change %s %s string", tableName, oldColName,
newColName);
+        String query = String.format("alter table %s.%s change %s %s string", dbName, tableName,
oldColName, newColName);
         runCommand(query);
 
         String guid2 = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn,
"id_new"));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7ae184e0/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index d1d3ec6..36a94b1 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -29,6 +29,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file
(dosset
 ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via
shwethags)
 
 ALL CHANGES:
+ATLAS-929 Add test for trait preservation on column rename for non-default database (svimal2106
via shwethags)
 ATLAS-926 Change version in 0.7 branch to 0.7-incubating (shwethags)
 ATLAS-922 remove test atlas-application.properties embedded in atlas-typesystem.jar (madhan.neethiraj
via yhemanth)
 ATLAS-725 UI : Filter out or highlight deleted entities in search result outputs(dsl, text)
, schema view, and lineage graph (kevalbhatt18 via sumasai)


Mime
View raw message