Commit c789f2d7 by Saqeeb Shaikh Committed by Sarath Subramanian

ATLAS-3565: Atlas server should set startTime and endTime for hive_process to…

ATLAS-3565: Atlas server should set startTime and endTime for hive_process to System.currentTimeMillis() if either of these are null. Signed-off-by: 's avatarSarath Subramanian <sarath@apache.org>
parent 67a7367a
......@@ -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 = '.';
......
......@@ -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,6 +167,17 @@ public class HivePreprocessor {
} else {
Object inputs = entity.getAttribute(ATTRIBUTE_INPUTS);
Object outputs = entity.getAttribute(ATTRIBUTE_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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment