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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new c2ec628  ATLAS-3444 Change Impala DDL qualifiedName and name to behave 
the same with Hive
c2ec628 is described below

commit c2ec628c7849e178c336e72ed6c178cb157fac27
Author: Le Ma <[email protected]>
AuthorDate: Tue Oct 8 14:22:29 2019 -0700

    ATLAS-3444 Change Impala DDL qualifiedName and name to behave the same with 
Hive
    
    Signed-off-by: Sarath Subramanian <[email protected]>
    (cherry picked from commit ec347a32aa7b9365235e6ae72b37b2aed85dac02)
---
 .../atlas/impala/hook/events/BaseImpalaEvent.java      | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git 
a/addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/events/BaseImpalaEvent.java
 
b/addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/events/BaseImpalaEvent.java
index 5329e8b..5e361f7 100644
--- 
a/addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/events/BaseImpalaEvent.java
+++ 
b/addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/events/BaseImpalaEvent.java
@@ -1,3 +1,4 @@
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -576,7 +577,13 @@ public abstract class BaseImpalaEvent {
     }
 
     protected Long getQueryStartTime() {
-        return context.getLineageQuery().getTimestamp() * 
BaseImpalaEvent.MILLIS_CONVERT_FACTOR;
+        Long startTime = null;
+        if (context.getLineageQuery() == null || 
context.getLineageQuery().getTimestamp() == null) {
+            startTime = System.currentTimeMillis();
+        } else {
+            startTime = context.getLineageQuery().getTimestamp() * 
BaseImpalaEvent.MILLIS_CONVERT_FACTOR;
+        }
+        return startTime;
     }
 
     protected Long getQueryEndTime() {
@@ -642,13 +649,16 @@ public abstract class BaseImpalaEvent {
             hiveDDL = new AtlasEntity(ImpalaDataType.HIVE_TABLE_DDL.getName(), 
ATTRIBUTE_TABLE, objId);
         }
 
+        Long startTime = getQueryStartTime();
+
         if (hiveDDL != null) {
             hiveDDL.setAttribute(ATTRIBUTE_SERVICE_TYPE, "impala");
-            hiveDDL.setAttribute(ATTRIBUTE_EXEC_TIME, getQueryStartTime());
+            hiveDDL.setAttribute(ATTRIBUTE_EXEC_TIME, startTime);
             hiveDDL.setAttribute(ATTRIBUTE_QUERY_TEXT, context.getQueryStr());
             hiveDDL.setAttribute(ATTRIBUTE_USER_NAME, getUserName());
-            hiveDDL.setAttribute(ATTRIBUTE_NAME, context.getQueryStr() + 
QNAME_SEP_PROCESS + getQueryStartTime().toString());
-            hiveDDL.setAttribute(ATTRIBUTE_QUALIFIED_NAME, 
hiveDDL.getAttribute(ATTRIBUTE_NAME));
+            hiveDDL.setAttribute(ATTRIBUTE_NAME, context.getQueryStr());
+            hiveDDL.setAttribute(ATTRIBUTE_QUALIFIED_NAME, 
dbOrTable.getAttribute(ATTRIBUTE_QUALIFIED_NAME).toString()
+                + QNAME_SEP_PROCESS + startTime.toString());
         }
 
         return hiveDDL;

Reply via email to