This is an automated email from the ASF dual-hosted git repository. sidmishra pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 6b3267ef622768918d08b550d7f28b435ea256a5 Author: lina.li <[email protected]> AuthorDate: Mon Jun 3 13:20:10 2019 -0700 ATLAS-3226: Add QueryText for hive_table and hive_db for Impala integration Signed-off-by: Sarath Subramanian <[email protected]> (cherry picked from commit 2f461b4217df7e1f6fcded17c83fc9ff7670a6d5) --- .../atlas/impala/hook/events/BaseImpalaEvent.java | 18 ++++-------------- .../org/apache/atlas/notification/spool/Publisher.java | 6 +++--- .../repository/graph/GraphBackedSearchIndexer.java | 2 +- 3 files changed, 8 insertions(+), 18 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 d840822..32efb83 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,4 +1,3 @@ - /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -580,13 +579,7 @@ public abstract class BaseImpalaEvent { } protected Long getQueryStartTime() { - 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; + return context.getLineageQuery().getTimestamp() * BaseImpalaEvent.MILLIS_CONVERT_FACTOR; } protected Long getQueryEndTime() { @@ -652,16 +645,13 @@ 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, startTime); + hiveDDL.setAttribute(ATTRIBUTE_EXEC_TIME, getQueryStartTime()); hiveDDL.setAttribute(ATTRIBUTE_QUERY_TEXT, context.getQueryStr()); hiveDDL.setAttribute(ATTRIBUTE_USER_NAME, getUserName()); - hiveDDL.setAttribute(ATTRIBUTE_NAME, context.getQueryStr()); - hiveDDL.setAttribute(ATTRIBUTE_QUALIFIED_NAME, dbOrTable.getAttribute(ATTRIBUTE_QUALIFIED_NAME).toString() - + QNAME_SEP_PROCESS + startTime.toString()); + hiveDDL.setAttribute(ATTRIBUTE_NAME, context.getQueryStr() + QNAME_SEP_PROCESS + getQueryStartTime().toString()); + hiveDDL.setAttribute(ATTRIBUTE_QUALIFIED_NAME, hiveDDL.getAttribute(ATTRIBUTE_NAME)); } return hiveDDL; diff --git a/notification/src/main/java/org/apache/atlas/notification/spool/Publisher.java b/notification/src/main/java/org/apache/atlas/notification/spool/Publisher.java index f4a42b5..01ead7d 100644 --- a/notification/src/main/java/org/apache/atlas/notification/spool/Publisher.java +++ b/notification/src/main/java/org/apache/atlas/notification/spool/Publisher.java @@ -136,9 +136,9 @@ public class Publisher implements Runnable { FileLockedReadWrite fileLockedRead = new FileLockedReadWrite(source); try { - DataInput dataInput = fileLockedRead.getInput(new File(record.getPath())); - int lineInSpoolFile = 0; - List<String> messages = new ArrayList<>(); + DataInput dataInput = fileLockedRead.getInput(new File(record.getPath())); + int lineInSpoolFile = 0; + List<String> messages = new ArrayList<>(); for (String message = dataInput.readLine(); message != null; message = dataInput.readLine()) { lineInSpoolFile++; diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java index e084717..ddfb008 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java @@ -511,7 +511,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang } if (typeDef instanceof AtlasStructDef) { - AtlasStructDef structDef = (AtlasStructDef) typeDef; + AtlasStructDef structDef = (AtlasStructDef) typeDef; List<AtlasAttributeDef> attributeDefs = structDef.getAttributeDefs(); if (CollectionUtils.isNotEmpty(attributeDefs)) {
