ATLAS-3621: updated HiveHook to not save query-string in multiple attributes - queryText and name - #2 (avoid excessive logs)
(cherry picked from commit 6eb72fa456e527baeb144245421e29bffa98592b)
diff --git a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
index a895834..0cb9507 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Objects;
public class HivePreprocessor {
private static final Logger LOG = LoggerFactory.getLogger(HivePreprocessor.class);
@@ -162,11 +163,14 @@
@Override
public void preprocess(AtlasEntity entity, PreprocessorContext context) {
if (context.updateHiveProcessNameWithQualifiedName()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("setting {}.name={}. topic-offset={}, partition={}", entity.getTypeName(), entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME), context.getKafkaMessageOffset(), context.getKafkaPartition());
- }
+ Object name = entity.getAttribute(ATTRIBUTE_NAME);
+ Object qualifiedName = entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME);
- entity.setAttribute(ATTRIBUTE_NAME, entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+ if (!Objects.equals(name, qualifiedName)) {
+ LOG.info("setting {}.name={}. topic-offset={}, partition={}", entity.getTypeName(), qualifiedName, context.getKafkaMessageOffset(), context.getKafkaPartition());
+
+ entity.setAttribute(ATTRIBUTE_NAME, qualifiedName);
+ }
}
if (context.isIgnoredEntity(entity.getGuid())) {