From 00ad604db3306b3932a8410efa27b79f5bfe45bb Mon Sep 17 00:00:00 2001 From: "Yi (Alan) Wang" Date: Fri, 29 Jun 2018 15:13:14 -0700 Subject: [PATCH] Prefer auditstamp actor over agent for MLE actor (#1244) --- .../processors/MetadataLineageProcessor.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wherehows-kafka/src/main/java/wherehows/processors/MetadataLineageProcessor.java b/wherehows-kafka/src/main/java/wherehows/processors/MetadataLineageProcessor.java index 8b28d1871c..1ab1c9387c 100644 --- a/wherehows-kafka/src/main/java/wherehows/processors/MetadataLineageProcessor.java +++ b/wherehows-kafka/src/main/java/wherehows/processors/MetadataLineageProcessor.java @@ -107,17 +107,17 @@ public class MetadataLineageProcessor extends KafkaMessageProcessor { * Get actor Urn string from app type or change audit stamp */ private String getActorUrn(MetadataLineageEvent event) { - // use app type first + // use actorUrn in ChangeAuditStamp first + ChangeAuditStamp auditStamp = event.changeAuditStamp; + if (auditStamp != null && auditStamp.actorUrn != null) { + return auditStamp.actorUrn.toString(); + } + + // use app type as fallback if (event.type != agent.UNUSED) { return "urn:li:multiProduct:" + event.type.name().toLowerCase(); } - - // if app type = UNUSED, use actorUrn in ChangeAuditStamp - ChangeAuditStamp auditStamp = event.changeAuditStamp; - if (auditStamp == null || auditStamp.actorUrn == null) { - throw new IllegalArgumentException("Requires ChangeAuditStamp actorUrn if MLE agent is UNUSED"); - } - return auditStamp.actorUrn.toString(); + throw new IllegalArgumentException("Require ChangeAuditStamp actorUrn"); } public FailedMetadataLineageEvent newFailedEvent(MetadataLineageEvent event, Throwable throwable) {