This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new 4e1eeb4 ATLAS-3198: Stop pushing message to ATLAS_HOOK for Truncate
Table/Delete data/Update data
4e1eeb4 is described below
commit 4e1eeb4cdcd8bc0601564434176eb200b2811c2e
Author: Yu-Hsin Shih <[email protected]>
AuthorDate: Thu May 30 15:29:51 2019 -0700
ATLAS-3198: Stop pushing message to ATLAS_HOOK for Truncate Table/Delete
data/Update data
Both ATLAS_HOOK and ATLAS_ENTITIES should stop receiving message from
Truncate Table/Delete data/Update data
Signed-off-by: Sarath Subramanian <[email protected]>
---
.../java/org/apache/atlas/hive/hook/HiveHook.java | 1 -
.../atlas/hive/hook/events/CreateHiveProcess.java | 7 ++++++-
.../java/org/apache/atlas/hive/hook/HiveHookIT.java | 21 ++++-----------------
3 files changed, 10 insertions(+), 19 deletions(-)
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 c0094c6..ffa56ce 100644
--- 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
@@ -206,7 +206,6 @@ public class HiveHook extends AtlasHook implements
ExecuteWithHookContext {
case EXPORT:
case IMPORT:
case QUERY:
- case TRUNCATETABLE:
event = new CreateHiveProcess(context);
break;
diff --git
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
index c4b3ac7..7791fb4 100644
---
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
+++
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
@@ -271,7 +271,12 @@ public class CreateHiveProcess extends BaseHiveEvent {
ret = true;
}
}
-
+ // DELETE and UPDATE initially have one input and one
output.
+ // Since they do not support sub-query, they won't create
a lineage that have one input and one output. (One input only)
+ // It's safe to filter them out here.
+ if (output.getWriteType() == WriteEntity.WriteType.DELETE
|| output.getWriteType() == WriteEntity.WriteType.UPDATE) {
+ ret = true;
+ }
}
}
}
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 c830162..6fce045 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
@@ -1674,30 +1674,17 @@ public class HiveHookIT extends HiveITBase {
}
@Test
- public void testTruncateTable() throws Exception {
+ public void testIgnoreTruncateTable() throws Exception {
String tableName = createTable(false);
- String query = String.format("truncate table %s", tableName);
+ String query = String.format("truncate table %s", tableName);
runCommand(query);
Set<WriteEntity> outputs = getOutputs(tableName, Entity.Type.TABLE);
- String tableId = assertTableIsRegistered(DEFAULT_DB,
tableName);
HiveEventContext event = constructEvent(query,
HiveOperation.TRUNCATETABLE, null, outputs);
- AtlasEntity processEntity = validateProcess(event);
- AtlasEntity processExecutionEntity1 =
validateProcessExecution(processEntity, event);
- AtlasObjectId process =
toAtlasObjectId(processExecutionEntity1.getRelationshipAttribute(
- BaseHiveEvent.ATTRIBUTE_PROCESS));
- Assert.assertEquals(process.getGuid(), processEntity.getGuid());
-
- //Check lineage
- String datasetName =
HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, DEFAULT_DB, tableName);
- AtlasLineageInfo atlasLineageInfoInput =
atlasClientV2.getLineageInfo(tableId,
AtlasLineageInfo.LineageDirection.INPUT,0);
- Map<String, AtlasEntityHeader> entityMap =
atlasLineageInfoInput.getGuidEntityMap();
-
- Assert.assertEquals(numberOfProcessExecutions(processEntity), 1);
- //Below should be assertTrue - Fix
https://issues.apache.org/jira/browse/ATLAS-653
- Assert.assertFalse(entityMap.containsKey(tableId));
+ assertTableIsRegistered(DEFAULT_DB, tableName);
+ assertProcessIsNotRegistered(event);
}
@Test