Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead committed Apr 17, 2024
1 parent bd1c1a4 commit 2518809
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ class CometExpressionCoverageSuite extends CometTestBase with AdaptiveSparkPlanH
}
} else {
// Plain example like SELECT cos(0);
testSingleLineQuery("select 'dummy' x", s"${q.dropRight(1)}, x from tbl")
testSingleLineQuery(
"select 'dummy' x",
s"${q.dropRight(1)}, x from tbl",
excludedOptimizerRules =
Some("org.apache.spark.sql.catalyst.optimizer.ConstantFolding"))
}
CoverageResult(CoverageResultStatus.Passed.toString, Seq((q, "OK")))
} catch {
Expand Down
6 changes: 4 additions & 2 deletions spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ abstract class CometTestBase
prepareQuery: String,
testQuery: String,
testName: String = "test",
tableName: String = "tbl"): Unit = {
tableName: String = "tbl",
excludedOptimizerRules: Option[String] = None): Unit = {

withTempDir { dir =>
val path = new Path(dir.toURI.toString, testName).toUri.toString
Expand All @@ -746,7 +747,8 @@ abstract class CometTestBase
// ConstantFolding is a operator optimization rule in Catalyst that replaces expressions
// that can be statically evaluated with their equivalent literal values.
withSQLConf(
"spark.sql.optimizer.excludedRules" -> "org.apache.spark.sql.catalyst.optimizer.ConstantFolding") {
"spark.sql.optimizer.excludedRules" -> excludedOptimizerRules.getOrElse(""),
"spark.sql.adaptive.optimizer.excludedRules" -> excludedOptimizerRules.getOrElse("")) {
checkSparkAnswerAndOperator(sql(testQuery))
}
}
Expand Down

0 comments on commit 2518809

Please sign in to comment.