This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-1.0 by this push:
     new a6496d2  ATLAS-3621: updated HiveHook to not save query-string in 
multiple attributes - queryText and name - #2 (avoid excessive logs)
a6496d2 is described below

commit a6496d2853d9dc1e75fef3f2311f35b45b1d6ed1
Author: Madhan Neethiraj <mad...@apache.org>
AuthorDate: Fri Feb 21 16:42:25 2020 -0800

    ATLAS-3621: updated HiveHook to not save query-string in multiple 
attributes - queryText and name - #2 (avoid excessive logs)
    
    (cherry picked from commit 6eb72fa456e527baeb144245421e29bffa98592b)
---
 .../atlas/notification/preprocessor/HivePreprocessor.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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 org.slf4j.LoggerFactory;
 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 @@ public class HivePreprocessor {
         @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);
+
+                if (!Objects.equals(name, qualifiedName)) {
+                    LOG.info("setting {}.name={}. topic-offset={}, 
partition={}", entity.getTypeName(), qualifiedName, 
context.getKafkaMessageOffset(), context.getKafkaPartition());
 
-                entity.setAttribute(ATTRIBUTE_NAME, 
entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+                    entity.setAttribute(ATTRIBUTE_NAME, qualifiedName);
+                }
             }
 
             if (context.isIgnoredEntity(entity.getGuid())) {

Reply via email to