Skip to content

Commit

Permalink
Test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Jun 4, 2024
1 parent a7baebc commit 4cd484b
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.gluten.execution
import org.apache.gluten.GlutenConfig
import org.apache.gluten.sql.shims.SparkShimLoader

import org.apache.spark.SparkConf
import org.apache.spark.sql.execution.CommandResultExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
import org.apache.spark.sql.internal.SQLConf
Expand Down Expand Up @@ -52,6 +53,11 @@ class VeloxMetricsSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
super.afterAll()
}

override protected def sparkConf: SparkConf = {
super.sparkConf
.set("spark.shuffle.manager", "org.apache.spark.shuffle.sort.ColumnarShuffleManager")
}

test("test sort merge join metrics") {
withSQLConf(
GlutenConfig.COLUMNAR_FPRCE_SHUFFLED_HASH_JOIN_ENABLED.key -> "false",
Expand Down Expand Up @@ -164,4 +170,34 @@ class VeloxMetricsSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
}
}
}

test("Metrics of window") {
runQueryAndCompare("SELECT c1, c2, sum(c2) over (partition by c1) as s FROM metrics_t1") {
df =>
val window = find(df.queryExecution.executedPlan) {
case _: WindowExecTransformer => true
case _ => false
}
assert(window.isDefined)
val metrics = window.get.metrics
assert(metrics("numOutputRows").value == 100)
assert(metrics("outputVectors").value == 2)
}
}

test("Metrics of noop filter's children") {
withSQLConf("spark.gluten.ras.enabled" -> "true") {
runQueryAndCompare("SELECT c1, c2 FROM metrics_t1 where c1 < 50") {
df =>
val scan = find(df.queryExecution.executedPlan) {
case _: FileSourceScanExecTransformer => true
case _ => false
}
assert(scan.isDefined)
val metrics = scan.get.metrics
assert(metrics("rawInputRows").value == 100)
assert(metrics("outputVectors").value == 1)
}
}
}
}

0 comments on commit 4cd484b

Please sign in to comment.