Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

public static final String MASK_PATTERN = "#### A masked pattern was here ####";
public static final String PARTIAL_MASK_PATTERN = "#### A PARTIAL masked pattern was here ####";
public static final String MASKED_VERTEX_KILLED_PATTERN = "[Masked Vertex killed due to OTHER_VERTEX_FAILURE]";
private static final PatternReplacementPair MASK_STATS = new PatternReplacementPair(
Pattern.compile(" Num rows: [1-9][0-9]* Data size: [1-9][0-9]*"),
" Num rows: ###Masked### Data size: ###Masked###");
Expand Down Expand Up @@ -197,6 +198,7 @@
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));

boolean lastWasMasked = false;
boolean lastWasVertexKilled = false;

while (null != (line = in.readLine())) {
LineProcessingResult result = processLine(line);
Expand All @@ -209,10 +211,22 @@
lastWasMasked = true;
result.partialMaskWasMatched = false;
}
lastWasVertexKilled = false;
} else if (result.line.equals(MASKED_VERTEX_KILLED_PATTERN)) {
// Deduplicate consecutive standalone vertex-killed lines — the number of sibling
// vertices still alive when the kill propagates is non-deterministic.
if (!lastWasVertexKilled) {
out.write(result.line);
out.write("\n");
lastWasVertexKilled = true;
}
lastWasMasked = false;
result.partialMaskWasMatched = false;
} else {
out.write(result.line);
out.write("\n");
lastWasMasked = false;
lastWasVertexKilled = false;
result.partialMaskWasMatched = false;
}
}
Expand Down Expand Up @@ -350,7 +364,16 @@
// We do not want the test to fail because of this.
ppm.add(new PatternReplacementPair(
Pattern.compile("Vertex killed, vertexName=(.*?),.*\\[\\1\\] killed\\/failed due to:OTHER_VERTEX_FAILURE\\]"),
"[Masked Vertex killed due to OTHER_VERTEX_FAILURE]"));
MASKED_VERTEX_KILLED_PATTERN));

// Collapse multiple consecutive embedded [Masked Vertex killed] tokens on the same line
// (the long FAILED: summary line repeats one token per killed vertex).
ppm.add(new PatternReplacementPair(Pattern.compile("(\\Q" + MASKED_VERTEX_KILLED_PATTERN + "\\E){2,}"),
MASKED_VERTEX_KILLED_PATTERN));

// The number of vertices killed when a DAG fails is a scheduling race condition —
// depends on how many sibling vertices are still running at the moment the kill propagates.
ppm.add(new PatternReplacementPair(Pattern.compile("killedVertices:[0-9]+"), "killedVertices:#Masked#"));

Check warning on line 376 in itests/util/src/main/java/org/apache/hadoop/hive/ql/QOutProcessor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use concise character class syntax '\\d' instead of '[0-9]'.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7WRrMczWk81O24nvIA&open=AZ7WRrMczWk81O24nvIA&pullRequest=6547

partialPlanMask = ppm.toArray(new PatternReplacementPair[ppm.size()]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,19 @@
qTestResultProcessor.overwriteResults(f.getPath(), outFileName);
return QTestProcessExecResult.createWithoutOutput(0);
} else {
return qTestResultProcessor.executeDiffCommand(f.getPath(), outFileName, false);
// Apply the same masking pipeline to a temporary copy of the reference file so that
// non-deterministic values (e.g. killedVertices) are normalized on both sides.
// This preserves backward compatibility with existing .q.out files that were written
// before the masking rules were introduced.
File maskedRef = new File(outFileName + ".masked_ref");
try {
FileUtils.copyFile(new File(outFileName), maskedRef);
qOutProcessor.maskPatterns(maskedRef.getPath());
return qTestResultProcessor.executeDiffCommand(f.getPath(), maskedRef.getPath(), false);
} finally {
maskedRef.delete();

Check warning on line 1033 in itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do something with the "boolean" value returned by "delete".

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7WRrRmzWk81O24nvIB&open=AZ7WRrRmzWk81O24nvIB&pullRequest=6547

Check warning on line 1033 in itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use "java.nio.file.Files#delete" here for better messages on error conditions.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7WRrRmzWk81O24nvIC&open=AZ7WRrRmzWk81O24nvIC&pullRequest=6547
new File(maskedRef.getPath() + ".orig").delete();

Check warning on line 1034 in itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use "java.nio.file.Files#delete" here for better messages on error conditions.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7WRrRmzWk81O24nvIE&open=AZ7WRrRmzWk81O24nvIE&pullRequest=6547

Check warning on line 1034 in itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do something with the "boolean" value returned by "delete".

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7WRrRmzWk81O24nvID&open=AZ7WRrRmzWk81O24nvID&pullRequest=6547
}
}
}

Expand Down
Loading