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:35:21 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 1c3b2befb -> 814f066d9


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/814f066d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/814f066d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/814f066d

Branch: refs/heads/master
Commit: 814f066d99eab276bf4cec44e9bd2d3839b95f7b
Parents: 1c3b2be
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Tue Jun 21 16:05:15 2016 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Tue Jun 21 16:05:15 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/814f066d/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/814f066d/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/814f066d/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 1ef9223..9941c7c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -38,6 +38,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-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)
 ATLAS-897 Atlas UI: Feature to associate multiple assets with a term. (kevalbhatt18 via sumasai)


Mime
View raw message