atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suma...@apache.org
Subject incubator-atlas git commit: ATLAS-635 Process showing old entity name where as actual entity is renamed ( svimal2106 via sumasai )
Date Fri, 27 May 2016 20:37:01 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 0143486ad -> 56c13aa36


ATLAS-635 Process showing old entity name where as actual entity is renamed ( svimal2106 via
sumasai )


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

Branch: refs/heads/master
Commit: 56c13aa366027c3eb1d4527bfb9286ddc3d61ffb
Parents: 0143486
Author: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Authored: Fri May 27 13:33:22 2016 -0700
Committer: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Committed: Fri May 27 13:36:18 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/hive/hook/HiveHook.java     |  7 +++++--
 .../atlas/hive/model/HiveDataModelGenerator.java      |  3 +++
 .../org/apache/atlas/hive/model/HiveDataTypes.java    |  2 +-
 .../java/org/apache/atlas/hive/hook/HiveHookIT.java   | 14 ++++++++++++++
 release-log.txt                                       |  1 +
 5 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/56c13aa3/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 4234664..3dfba05 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
@@ -51,6 +51,7 @@ import org.apache.hadoop.hive.ql.metadata.Partition;
 import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.plan.HiveOperation;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.log4j.LogManager;
 import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,9 +74,9 @@ import java.util.concurrent.TimeUnit;
  * AtlasHook sends lineage information to the AtlasSever.
  */
 public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
-
     private static final Logger LOG = LoggerFactory.getLogger(HiveHook.class);
 
+
     public static final String CONF_PREFIX = "atlas.hook.hive.";
     private static final String MIN_THREADS = CONF_PREFIX + "minThreads";
     private static final String MAX_THREADS = CONF_PREFIX + "maxThreads";
@@ -406,7 +407,9 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext
{
         final Referenceable newEntity = new Referenceable(HiveDataTypes.HIVE_TABLE.getName());
         newEntity.set(HiveDataModelGenerator.NAME, newTableQFName);
         newEntity.set(HiveDataModelGenerator.TABLE_NAME, newTable.getTableName().toLowerCase());
-
+        ArrayList<String> alias_list = new ArrayList<>();
+        alias_list.add(oldTable.getTableName().toLowerCase());
+        newEntity.set(HiveDataModelGenerator.TABLE_ALIAS_LIST, alias_list);
         messages.add(new HookNotification.EntityPartialUpdateRequest(event.getUser(),
             HiveDataTypes.HIVE_TABLE.getName(), HiveDataModelGenerator.NAME,
             oldTableQFName, newEntity));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/56c13aa3/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
index 347405c..e9b4256 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
@@ -65,6 +65,7 @@ public class HiveDataModelGenerator {
     public static final String PARAMETERS = "parameters";
     public static final String COLUMNS = "columns";
     public static final String PART_COLS = "partitionKeys";
+    public static final String TABLE_ALIAS_LIST = "aliases";
 
     public static final String STORAGE_NUM_BUCKETS = "numBuckets";
     public static final String STORAGE_IS_STORED_AS_SUB_DIRS = "storedAsSubDirectories";
@@ -257,6 +258,8 @@ public class HiveDataModelGenerator {
                         null),
                 new AttributeDefinition(PART_COLS, DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()),
                         Multiplicity.OPTIONAL, true, null),
+                new AttributeDefinition(TABLE_ALIAS_LIST, DataTypes.arrayTypeName(DataTypes.STRING_TYPE.getName()),
+                        Multiplicity.OPTIONAL, true, null),
                 new AttributeDefinition("columns", DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()),
                         Multiplicity.OPTIONAL, true, null),
                 new AttributeDefinition(HiveDataModelGenerator.PARAMETERS, STRING_MAP_TYPE.getName(),
Multiplicity.OPTIONAL, false, null),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/56c13aa3/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataTypes.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataTypes.java
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataTypes.java
index f376e6e..e094cb6 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataTypes.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataTypes.java
@@ -42,7 +42,7 @@ public enum HiveDataTypes {
     HIVE_INDEX,
     HIVE_ROLE,
     HIVE_TYPE,
-    HIVE_PROCESS,
+    HIVE_PROCESS
     // HIVE_VIEW,
     ;
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/56c13aa3/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 4223d90..8e6f9c0 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
@@ -627,6 +627,20 @@ public class HiveHookIT {
     }
 
     @Test
+    public void testAlterTableRenameAliasRegistered() throws Exception{
+        String tableName = createTable(false);
+        String tableGuid = assertTableIsRegistered(DEFAULT_DB, tableName);
+        String newTableName = tableName();
+        String query = String.format("alter table %s rename to %s", tableName, newTableName);
+        runCommand(query);
+        String newTableGuid = assertTableIsRegistered(DEFAULT_DB, newTableName);
+        Map<String, Object> valueMap = atlasClient.getEntity(newTableGuid).getValuesMap();
+        Iterable<String> aliasList = (Iterable<String>) valueMap.get("aliases");
+        String aliasTableName = aliasList.iterator().next();
+        assert tableName.toLowerCase().equals(aliasTableName);
+    }
+
+    @Test
     public void testAlterTableRename() throws Exception {
         String tableName = createTable(true);
         final String newDBName = createDatabase();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/56c13aa3/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 5498486..977fcf4 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -22,6 +22,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-635 Process showing old entity name where as actual entity is renamed ( svimal2106
via sumasai )
 ATLAS-823 Atlas should use external HBase and SOLR (tbeerbower via shwethags)
 ATLAS-752 Column renames should retain traits/tags (svimal2106 via shwethags)
 ATLAS-821 Atlas UI - Add arrow to navigate to child term (kevalbhatt18 via yhemanth)


Mime
View raw message