Skip to content

Commit

Permalink
fix: handle potential null node in DQ failure lineage (#18707)
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyCr authored Nov 20, 2024
1 parent de4a2cd commit 0dca536
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,11 @@ private void traceBackDQLineage(
processedNodes.add(nodeFailureId);
if (nodesWithFailures.contains(nodeFailureId)) {
Map<String, Object> node = allNodes.get(nodeFailureId);
node.keySet().removeAll(FIELDS_TO_REMOVE);
node.remove("lineage");
nodes.add(allNodes.get(nodeFailureId));
if (node != null) {
node.keySet().removeAll(FIELDS_TO_REMOVE);
node.remove("lineage");
nodes.add(node);
}
}
List<Map<String, Object>> edgesForNode = allEdges.get(nodeFailureId);
if (edgesForNode != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,8 @@ private void searchDataQualityLineage(
nodesWithFailures,
new HashSet<>());
for (String nodeWithFailure : nodesWithFailures) {
traceBackDQLineage(nodeWithFailure, allEdges, allNodes, nodes, edges, new HashSet<>());
traceBackDQLineage(
nodeWithFailure, nodesWithFailures, allEdges, allNodes, nodes, edges, new HashSet<>());
}
}

Expand Down Expand Up @@ -1154,6 +1155,7 @@ private void collectNodesAndEdges(

private void traceBackDQLineage(
String nodeFailureId,
Set<String> nodesWithFailures,
Map<String, List<Map<String, Object>>> allEdges,
Map<String, Map<String, Object>> allNodes,
Set<Map<String, Object>> nodes,
Expand All @@ -1164,7 +1166,14 @@ private void traceBackDQLineage(
}

processedNodes.add(nodeFailureId);
nodes.add(allNodes.get(nodeFailureId));
if (nodesWithFailures.contains(nodeFailureId)) {
Map<String, Object> node = allNodes.get(nodeFailureId);
if (node != null) {
node.keySet().removeAll(FIELDS_TO_REMOVE);
node.remove("lineage");
nodes.add(node);
}
}
List<Map<String, Object>> edgesForNode = allEdges.get(nodeFailureId);
if (edgesForNode != null) {
for (Map<String, Object> edge : edgesForNode) {
Expand All @@ -1173,7 +1182,14 @@ private void traceBackDQLineage(
if (!fromEntityId.equals(nodeFailureId)) continue; // skip if the edge is from the node
Map<String, String> toEntity = (Map<String, String>) edge.get("toEntity");
edges.add(edge);
traceBackDQLineage(toEntity.get("id"), allEdges, allNodes, nodes, edges, processedNodes);
traceBackDQLineage(
toEntity.get("id"),
nodesWithFailures,
allEdges,
allNodes,
nodes,
edges,
processedNodes);
}
}
}
Expand Down

0 comments on commit 0dca536

Please sign in to comment.