Skip to content

Commit

Permalink
move ut
Browse files Browse the repository at this point in the history
  • Loading branch information
zml1206 committed Jul 3, 2024
1 parent 7375148 commit 9d8c084
Showing 1 changed file with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,6 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu
.set("spark.sql.sources.useV1SourceList", "avro")
}

test("drop redundant partial sort which has pre-project when offload sortAgg") {
// Spark 3.2 does not have this configuration, but it does not affect the test results.
withSQLConf("spark.sql.test.forceApplySortAggregate" -> "true") {
withTempView("t1") {
Seq((-1, 2), (-1, 3), (2, 3), (3, 4), (-3, 5), (4, 5))
.toDF("c1", "c2")
.createOrReplaceTempView("t1")
runQueryAndCompare("select c2, sum(if(c1<0,0,c1)) from t1 group by c2") {
df =>
{
assert(
getExecutedPlan(df).count(
plan => {
plan.isInstanceOf[HashAggregateExecTransformer]
}) == 2)
assert(
getExecutedPlan(df).count(
plan => {
plan.isInstanceOf[SortExecTransformer]
}) == 0)
}
}
}
}
}

test("count") {
val df =
runQueryAndCompare("select count(*) from lineitem where l_partkey in (1552, 674, 1062)") {
Expand Down Expand Up @@ -1161,6 +1135,32 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu
df.select(max(col("txn"))).collect

}

test("drop redundant partial sort which has pre-project when offload sortAgg") {
// Spark 3.2 does not have this configuration, but it does not affect the test results.
withSQLConf("spark.sql.test.forceApplySortAggregate" -> "true") {
withTempView("t1") {
Seq((-1, 2), (-1, 3), (2, 3), (3, 4), (-3, 5), (4, 5))
.toDF("c1", "c2")
.createOrReplaceTempView("t1")
runQueryAndCompare("select c2, sum(if(c1<0,0,c1)) from t1 group by c2") {
df =>
{
assert(
getExecutedPlan(df).count(
plan => {
plan.isInstanceOf[HashAggregateExecTransformer]
}) == 2)
assert(
getExecutedPlan(df).count(
plan => {
plan.isInstanceOf[SortExecTransformer]
}) == 0)
}
}
}
}
}
}

class VeloxAggregateFunctionsDefaultSuite extends VeloxAggregateFunctionsSuite {
Expand Down

0 comments on commit 9d8c084

Please sign in to comment.