Skip to content

Commit 93dcc08

Browse files
committed
fix ci
1 parent bb039d4 commit 93dcc08

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHFilterExecTransformer.scala

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
package org.apache.gluten.execution
1818

19-
import org.apache.spark.sql.catalyst.expressions.{And, Expression}
19+
import org.apache.spark.sql.catalyst.expressions.{And, Expression, ExprId, IsNotNull, ScalaUDF}
2020
import org.apache.spark.sql.execution.SparkPlan
2121

2222
case class CHFilterExecTransformer(condition: Expression, child: SparkPlan)
@@ -48,4 +48,13 @@ case class FilterExecTransformer(condition: Expression, child: SparkPlan)
4848
override protected def getRemainingCondition: Expression = condition
4949
override protected def withNewChildInternal(newChild: SparkPlan): FilterExecTransformer =
5050
copy(child = newChild)
51+
override protected val notNullAttributes: Seq[ExprId] = condition match {
52+
case s: ScalaUDF =>
53+
val (notNullPreds, _) = s.children.partition {
54+
case IsNotNull(a) => isNullIntolerant(a) && a.references.subsetOf(child.outputSet)
55+
case _ => false
56+
}
57+
notNullPreds.flatMap(_.references).distinct.map(_.exprId)
58+
case _ => notNullPreds.flatMap(_.references).distinct.map(_.exprId)
59+
}
5160
}

backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenFunctionValidateSuite.scala

+9-20
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
6363
.set("spark.io.compression.codec", "snappy")
6464
.set("spark.sql.shuffle.partitions", "5")
6565
.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
66-
.set("spark.gluten.sql.supported.collapseNestedFunctions", "and,or")
6766
}
6867

6968
override def beforeAll(): Unit = {
@@ -208,10 +207,6 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
208207
spark.catalog.createTable("url_table", urlFilePath, fileFormat)
209208
}
210209

211-
override def afterAll(): Unit = {
212-
sparkConf.set("spark.gluten.sql.supported.collapseNestedFunctions", "")
213-
}
214-
215210
test("Test get_json_object 1") {
216211
runQueryAndCompare("SELECT get_json_object(string_field1, '$.a') from json_test") {
217212
checkGlutenOperatorMatch[ProjectExecTransformer]
@@ -399,21 +394,15 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
399394
}
400395
false
401396
}
402-
try {
403-
withSQLConf(("spark.gluten.sql.supported.collapseNestedFunctions", "and,or")) {
404-
runQueryAndCompare(
405-
"SELECT count(1) from json_test where int_field1 = 5 and double_field1 > 1.0" +
406-
" and string_field1 is not null") {
407-
x => assert(checkCollapsedFunctions(x.queryExecution.executedPlan, "and", 5))
408-
}
409-
runQueryAndCompare(
410-
"SELECT count(1) from json_test where int_field1 = 5 or double_field1 > 1.0" +
411-
" or string_field1 is not null") {
412-
x => assert(checkCollapsedFunctions(x.queryExecution.executedPlan, "or", 3))
413-
}
414-
}
415-
} finally {
416-
sparkConf.set("spark.gluten.sql.supported.collapseNestedFunctions", "")
397+
runQueryAndCompare(
398+
"SELECT count(1) from json_test where int_field1 = 5 and double_field1 > 1.0" +
399+
" and string_field1 is not null") {
400+
x => assert(checkCollapsedFunctions(x.queryExecution.executedPlan, "and", 5))
401+
}
402+
runQueryAndCompare(
403+
"SELECT count(1) from json_test where int_field1 = 5 or double_field1 > 1.0" +
404+
" or string_field1 is not null") {
405+
x => assert(checkCollapsedFunctions(x.queryExecution.executedPlan, "or", 3))
417406
}
418407
}
419408

shims/common/src/main/scala/org/apache/gluten/config/GlutenConfig.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ object GlutenConfig {
696696
.internal()
697697
.doc("Collapse nested functions as one for optimization.")
698698
.stringConf
699-
.createWithDefault("");
699+
.createWithDefault("and,or");
700700

701701
val GLUTEN_SOFT_AFFINITY_ENABLED =
702702
buildConf("spark.gluten.soft-affinity.enabled")

0 commit comments

Comments
 (0)