Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
zml1206 committed Dec 6, 2024
1 parent 5ca4044 commit dbb0842
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.apache.gluten.utils.VeloxFileSystemValidationJniWrapper
import org.apache.spark.SparkConf
import org.apache.spark.sql.catalyst.expressions.GreaterThan
import org.apache.spark.sql.execution.ScalarSubquery
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types._

class VeloxScanSuite extends VeloxWholeStageTransformerSuite {
Expand Down Expand Up @@ -150,4 +151,40 @@ class VeloxScanSuite extends VeloxWholeStageTransformerSuite {
}
}
}

test("push partial filters to offload scan when filter need fallback - v1") {
withSQLConf(GlutenConfig.EXPRESSION_BLACK_LIST.key -> "add") {
createTPCHNotNullTables()
val query = "select l_partkey from lineitem where l_partkey + 1 > 5 and l_partkey - 1 < 8"
runQueryAndCompare(query) {
df =>
{
val executedPlan = getExecutedPlan(df)
val scans = executedPlan.collect { case p: FileSourceScanExecTransformer => p }
assert(scans.size == 1)
// isnotnull(l_partkey) and l_partkey - 1 < 8
assert(scans.head.filterExprs().size == 2)
}
}
}
}

test("push partial filters to offload scan when filter need fallback - v2") {
withSQLConf(
GlutenConfig.EXPRESSION_BLACK_LIST.key -> "add",
SQLConf.USE_V1_SOURCE_LIST.key -> "") {
createTPCHNotNullTables()
val query = "select l_partkey from lineitem where l_partkey + 1 > 5 and l_partkey - 1 < 8"
runQueryAndCompare(query) {
df =>
{
val executedPlan = getExecutedPlan(df)
val scans = executedPlan.collect { case p: BatchScanExecTransformer => p }
assert(scans.size == 1)
// isnotnull(l_partkey) and l_partkey - 1 < 8
assert(scans.head.filterExprs().size == 2)
}
}
}
}
}

0 comments on commit dbb0842

Please sign in to comment.