-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bug_fix_log_function_diff
- Loading branch information
Showing
6 changed files
with
242 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
backends-velox/src/test/scala/io/glutenproject/execution/VeloxMetricsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.glutenproject.execution | ||
|
||
import io.glutenproject.GlutenConfig | ||
|
||
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper | ||
import org.apache.spark.sql.internal.SQLConf | ||
|
||
class VeloxMetricsSuite extends VeloxWholeStageTransformerSuite with AdaptiveSparkPlanHelper { | ||
override protected val backend: String = "velox" | ||
override protected val resourcePath: String = "/tpch-data-parquet-velox" | ||
override protected val fileFormat: String = "parquet" | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
|
||
spark | ||
.range(100) | ||
.selectExpr("id as c1", "id % 3 as c2") | ||
.write | ||
.format("parquet") | ||
.saveAsTable("metrics_t1") | ||
|
||
spark | ||
.range(200) | ||
.selectExpr("id as c1", "id % 3 as c2") | ||
.write | ||
.format("parquet") | ||
.saveAsTable("metrics_t2") | ||
} | ||
|
||
override protected def afterAll(): Unit = { | ||
spark.sql("drop table metrics_t1") | ||
spark.sql("drop table metrics_t2") | ||
|
||
super.afterAll() | ||
} | ||
|
||
test("test sort merge join metrics") { | ||
withSQLConf( | ||
GlutenConfig.COLUMNAR_FPRCE_SHUFFLED_HASH_JOIN_ENABLED.key -> "false", | ||
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 _: SortMergeJoinExecTransformer => 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 _: SortMergeJoinExecTransformer => 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("bufferPreProjectionCpuCount").value > 0) | ||
} | ||
} | ||
} | ||
|
||
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) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
gluten-data/src/main/scala/io/glutenproject/metrics/SortMergeJoinMetricsUpdater.scala
This file was deleted.
Oops, something went wrong.