Skip to content

Commit 1661bc5

Browse files
committed
chore: display schema for datasets being compared
1 parent ce5a441 commit 1661bc5

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

fuzz-testing/src/main/scala/org/apache/comet/fuzz/ComparisonTool.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ object ComparisonTool {
117117
// Compare the results
118118
if (QueryComparison.assertSameRows(sparkRows, cometRows, output)) {
119119
output.write(s"Subfolder $subfolderName: ${sparkRows.length} rows matched\n\n")
120+
} else {
121+
// Output schema if dataframes are not equal
122+
QueryComparison.showSchema(
123+
output,
124+
sparkDf.schema.treeString,
125+
cometDf.schema.treeString)
120126
}
121127
} catch {
122128
case e: Exception =>

fuzz-testing/src/main/scala/org/apache/comet/fuzz/QueryRunner.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,10 @@ object QueryComparison {
156156
val r = cometRows(i)
157157

158158
// Check the schema is equal for first row only
159-
if (i == 0) {
160-
showSchema(output, l.schema.treeString, r.schema.treeString)
159+
if (i == 0 && l.schema != r.schema) {
160+
output.write("[ERROR] Spark produced different schema than Comet.\n")
161161

162-
if (l.schema != r.schema) {
163-
output.write("[ERROR] Spark produced different schema than Comet.\n")
164-
165-
return false
166-
}
162+
return false
167163
}
168164

169165
assert(l.length == r.length)

0 commit comments

Comments
 (0)