Commit 47f2e77b by Sarath Subramanian

ATLAS-3590: Hive hook should ignore capturing lineage for temporary tables in CTAS queries

parent 0ac95349
......@@ -201,7 +201,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
case EXPORT:
case IMPORT:
case QUERY:
event = new CreateHiveProcess(context);
event = new CreateHiveProcess(context, true);
break;
case ALTERTABLE_FILEFORMAT:
......
......@@ -230,14 +230,14 @@ public abstract class BaseHiveEvent {
}
}
protected AtlasEntity getInputOutputEntity(Entity entity, AtlasEntityExtInfo entityExtInfo) throws Exception {
protected AtlasEntity getInputOutputEntity(Entity entity, AtlasEntityExtInfo entityExtInfo, boolean skipTempTables) throws Exception {
AtlasEntity ret = null;
switch(entity.getType()) {
case TABLE:
case PARTITION:
case DFS_DIR: {
ret = toAtlasEntity(entity, entityExtInfo);
ret = toAtlasEntity(entity, entityExtInfo, skipTempTables);
}
break;
}
......@@ -245,7 +245,7 @@ public abstract class BaseHiveEvent {
return ret;
}
protected AtlasEntity toAtlasEntity(Entity entity, AtlasEntityExtInfo entityExtInfo) throws Exception {
protected AtlasEntity toAtlasEntity(Entity entity, AtlasEntityExtInfo entityExtInfo, boolean skipTempTables) throws Exception {
AtlasEntity ret = null;
switch (entity.getType()) {
......@@ -271,6 +271,10 @@ public abstract class BaseHiveEvent {
}
if (!skipTable) {
skipTable = skipTempTables && entity.getTable().isTemporary();
}
if (!skipTable) {
Table table = getHive().getTable(dbName, tableName);
ret = toTableEntity(table, entityExtInfo);
......
......@@ -49,9 +49,12 @@ import java.util.Set;
public class CreateHiveProcess extends BaseHiveEvent {
private static final Logger LOG = LoggerFactory.getLogger(CreateHiveProcess.class);
private final boolean skipTempTables;
public CreateHiveProcess(AtlasHiveHookContext context) {
public CreateHiveProcess(AtlasHiveHookContext context, boolean skipTempTables) {
super(context);
this.skipTempTables = skipTempTables;
}
@Override
......@@ -84,7 +87,7 @@ public class CreateHiveProcess extends BaseHiveEvent {
continue;
}
AtlasEntity entity = getInputOutputEntity(input, ret);
AtlasEntity entity = getInputOutputEntity(input, ret, skipTempTables);
if (!input.isDirect()) {
continue;
......@@ -104,7 +107,7 @@ public class CreateHiveProcess extends BaseHiveEvent {
continue;
}
AtlasEntity entity = getInputOutputEntity(output, ret);
AtlasEntity entity = getInputOutputEntity(output, ret, skipTempTables);
if (entity != null) {
outputs.add(entity);
......
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