Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Dec 5, 2023
1 parent 3082667 commit ffb0cb3
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,41 @@ class VeloxMetricsSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
}
}
}

test("test shuffle hash join metrics") {
withSQLConf(SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "-1") {
// without preproject
runQueryAndCompare(
"SELECT * FROM metrics_t1 join metrics_t2 on metrics_t1.c1 = metrics_t2.c1"
) {
df =>
val smj = find(df.queryExecution.executedPlan) {
case _: ShuffledHashJoinExecTransformer => true
case _ => false
}
assert(smj.isDefined)
val metrics = smj.get.metrics
assert(metrics("numOutputRows").value == 100)
assert(metrics("numOutputVectors").value > 0)
assert(metrics("numOutputBytes").value > 0)
}

// with preproject
runQueryAndCompare(
"SELECT * FROM metrics_t1 join metrics_t2 on metrics_t1.c1 + 1 = metrics_t2.c1 + 1"
) {
df =>
val smj = find(df.queryExecution.executedPlan) {
case _: ShuffledHashJoinExecTransformer => true
case _ => false
}
assert(smj.isDefined)
val metrics = smj.get.metrics
assert(metrics("numOutputRows").value == 100)
assert(metrics("numOutputVectors").value > 0)
assert(metrics("streamPreProjectionCpuCount").value > 0)
assert(metrics("buildPreProjectionCpuCount").value > 0)
}
}
}
}

0 comments on commit ffb0cb3

Please sign in to comment.