Skip to content
Merged
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 @@ -117,6 +117,12 @@ object ComparisonTool {
// Compare the results
if (QueryComparison.assertSameRows(sparkRows, cometRows, output)) {
output.write(s"Subfolder $subfolderName: ${sparkRows.length} rows matched\n\n")
} else {
// Output schema if dataframes are not equal
QueryComparison.showSchema(
output,
sparkDf.schema.treeString,
cometDf.schema.treeString)
}
} catch {
case e: Exception =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,10 @@ object QueryComparison {
while (i < sparkRows.length) {
val l = sparkRows(i)
val r = cometRows(i)

// Check the schema is equal for first row only
if (i == 0 && l.schema != r.schema) {
output.write(
s"[ERROR] Spark produced schema ${l.schema} and " +
s"Comet produced schema ${r.schema} rows.\n")
output.write("[ERROR] Spark produced different schema than Comet.\n")

return false
}
Expand Down Expand Up @@ -254,4 +253,11 @@ object QueryComparison {
w.write("### Comet Plan\n")
w.write(s"```\n$cometPlan\n```\n")
}

def showSchema(w: BufferedWriter, sparkSchema: String, cometSchema: String): Unit = {
w.write("### Spark Schema\n")
w.write(s"```\n$sparkSchema\n```\n")
w.write("### Comet Schema\n")
w.write(s"```\n$cometSchema\n```\n")
}
}
Loading