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 c789f2d ATLAS-3565: Atlas server should set startTime and endTime for
hive_process to System.currentTimeMillis() if either of these are null.
c789f2d is described below
commit c789f2d7e5efa3d7c85829016541097319006651
Author: Saqeeb Shaikh <[email protected]>
AuthorDate: Thu Dec 19 14:30:52 2019 +0530
ATLAS-3565: Atlas server should set startTime and endTime for hive_process
to System.currentTimeMillis() if either of these are null.
Signed-off-by: Sarath Subramanian <[email protected]>
---
.../notification/preprocessor/EntityPreprocessor.java | 2 ++
.../notification/preprocessor/HivePreprocessor.java | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
index 0cddd41..89568e2 100644
---
a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
+++
b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
@@ -55,6 +55,8 @@ public abstract class EntityPreprocessor {
public static final String ATTRIBUTE_INDEXES = "indexes";
public static final String ATTRIBUTE_FOREIGN_KEYS = "foreign_keys";
public static final String ATTRIBUTE_INSTANCE = "instance";
+ public static final String ATTRIBUTE_START_TIME = "startTime";
+ public static final String ATTRIBUTE_END_TIME = "endTime";
public static final char QNAME_SEP_CLUSTER_NAME = '@';
public static final char QNAME_SEP_ENTITY_NAME = '.';
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 d31495c..cc5fe52 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
@@ -17,6 +17,7 @@
*/
package org.apache.atlas.notification.preprocessor;
+import com.google.common.base.Strings;
import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.notification.preprocessor.PreprocessorContext.PreprocessAction;
import org.apache.commons.lang.StringUtils;
@@ -166,8 +167,19 @@ public class HivePreprocessor {
} else {
Object inputs = entity.getAttribute(ATTRIBUTE_INPUTS);
Object outputs = entity.getAttribute(ATTRIBUTE_OUTPUTS);
- int inputsCount = getCollectionSize(inputs);
- int outputsCount = getCollectionSize(outputs);
+ String startTime =
String.valueOf(entity.getAttribute(ATTRIBUTE_START_TIME));
+ String endTime =
String.valueOf(entity.getAttribute(ATTRIBUTE_END_TIME));
+
+ if (Strings.isNullOrEmpty(startTime) ||
"null".equals(startTime)) {
+ entity.setAttribute(ATTRIBUTE_START_TIME,
System.currentTimeMillis());
+ }
+
+ if (Strings.isNullOrEmpty(endTime) || "null".equals(endTime)) {
+ entity.setAttribute(ATTRIBUTE_END_TIME,
System.currentTimeMillis());
+ }
+
+ int inputsCount = getCollectionSize(inputs);
+ int outputsCount = getCollectionSize(outputs);
removeIgnoredObjectIds(inputs, context);
removeIgnoredObjectIds(outputs, context);