diff --git a/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala b/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala index 5e02722d6..28901bf46 100644 --- a/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala @@ -87,7 +87,13 @@ class CometExpressionCoverageSuite extends CometTestBase with AdaptiveSparkPlanH CoverageResult("FAILED", Seq((q, "Cannot parse properly")))) } } else { - // Plain example like SELECT cos(0); + // Process the simple example like `SELECT cos(0);` + // + // The execution disables constant folding. This optimization rule precomputes and selects the value as literal + // which subsequently leads to false positives + // + // ConstantFolding is a operator optimization rule in Catalyst that replaces expressions + // that can be statically evaluated with their equivalent literal values. testSingleLineQuery( "select 'dummy' x", s"${q.dropRight(1)}, x from tbl", diff --git a/spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala b/spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala index 135b2f937..77124311e 100644 --- a/spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala +++ b/spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala @@ -741,11 +741,6 @@ abstract class CometTestBase spark.createDataFrame(data, schema).repartition(1).write.parquet(path) readParquetFile(path, Some(schema)) { df => df.createOrReplaceTempView(tableName) } - // disable constant folding. This optimization rule precompute and select value as literal - // which subsequently leads to false positives - // - // 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" -> excludedOptimizerRules.getOrElse(""), "spark.sql.adaptive.optimizer.excludedRules" -> excludedOptimizerRules.getOrElse("")) {