Skip to content

Commit

Permalink
fix metric
Browse files Browse the repository at this point in the history
  • Loading branch information
loneylee committed Jul 2, 2024
1 parent 70fb353 commit f68aaca
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public static long build(

int joinType;
if (broadCastContext.buildHashTableId().startsWith("BuiltBNLJBroadcastTable-")) {
joinType = SubstraitUtil.toSubstrait(broadCastContext.joinType()).ordinal();
} else {
joinType = SubstraitUtil.toCrossRelSubstrait(broadCastContext.joinType()).ordinal();
} else {
joinType = SubstraitUtil.toSubstrait(broadCastContext.joinType()).ordinal();
}

return nativeBuild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,6 @@ class CHMetricsApi extends MetricsApi with Logging with LogLevelUtil {
"extraTime" -> SQLMetrics.createTimingMetric(sparkContext, "extra operators time"),
"inputWaitTime" -> SQLMetrics.createTimingMetric(sparkContext, "time of waiting for data"),
"outputWaitTime" -> SQLMetrics.createTimingMetric(sparkContext, "time of waiting for output"),
"streamPreProjectionTime" ->
SQLMetrics.createTimingMetric(sparkContext, "time of stream side preProjection"),
"buildPreProjectionTime" ->
SQLMetrics.createTimingMetric(sparkContext, "time of build side preProjection"),
"postProjectTime" ->
SQLMetrics.createTimingMetric(sparkContext, "time of postProjection"),
"probeTime" ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,6 @@ class BroadcastNestedLoopJoinMetricsUpdater(val metrics: Map[String, SQLMetric])
var currentIdx = operatorMetrics.metricsList.size() - 1
var totalTime = 0L

// build side pre projection
if (joinParams.buildPreProjectionNeeded) {
metrics("buildPreProjectionTime") +=
(operatorMetrics.metricsList.get(currentIdx).time / 1000L).toLong
metrics("outputVectors") += operatorMetrics.metricsList.get(currentIdx).outputVectors
totalTime += operatorMetrics.metricsList.get(currentIdx).time
currentIdx -= 1
}

// stream side pre projection
if (joinParams.streamPreProjectionNeeded) {
metrics("streamPreProjectionTime") +=
(operatorMetrics.metricsList.get(currentIdx).time / 1000L).toLong
metrics("outputVectors") += operatorMetrics.metricsList.get(currentIdx).outputVectors
totalTime += operatorMetrics.metricsList.get(currentIdx).time
currentIdx -= 1
}

// update fillingRightJoinSideTime
MetricsUtil
.getAllProcessorList(operatorMetrics.metricsList.get(currentIdx))
Expand All @@ -76,6 +58,8 @@ class BroadcastNestedLoopJoinMetricsUpdater(val metrics: Map[String, SQLMetric])
}
if (processor.name.equalsIgnoreCase("FilterTransform")) {
metrics("conditionTime") += (processor.time / 1000L).toLong
metrics("numOutputRows") += processor.outputRows - processor.inputRows
metrics("outputBytes") += processor.outputBytes - processor.inputBytes
}
if (processor.name.equalsIgnoreCase("JoiningTransform")) {
metrics("probeTime") += (processor.time / 1000L).toLong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ abstract class GlutenClickHouseTPCDSAbstractSuite
Seq("q" + "%d".format(queryNum))
}
val noFallBack = queryNum match {
case i
if i == 10 || i == 16 || i == 35 || i == 45 || i == 77 ||
i == 94 =>
case i if i == 10 || i == 16 || i == 35 || i == 45 || i == 94 =>
// Q10 BroadcastHashJoin, ExistenceJoin
// Q16 ShuffledHashJoin, NOT condition
// Q35 BroadcastHashJoin, ExistenceJoin
// Q45 BroadcastHashJoin, ExistenceJoin
// Q77 CartesianProduct
// Q94 BroadcastHashJoin, LeftSemi, NOT condition
(false, false)
case j if j == 38 || j == 87 =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ abstract class BroadcastNestedLoopJoinExecTransformer(

// Hint substrait to switch the left and right,
// since we assume always build right side in substrait.
protected lazy val needSwitchChildren: Boolean = buildSide match {
private lazy val needSwitchChildren: Boolean = buildSide match {
case BuildLeft => true
case BuildRight => false
}
Expand Down

0 comments on commit f68aaca

Please sign in to comment.