wangyum commented on code in PR #13725:
URL: https://github.com/apache/gluten/pull/13725#discussion_r4667184980


##########
gluten-iceberg/src/test/scala/org/apache/gluten/execution/IcebergSuite.scala:
##########
@@ -289,6 +290,51 @@ abstract class IcebergSuite extends 
WholeStageTransformerSuite {
     }
   }
 
+  test("iceberg bucketed join with a runtime filter that removes every 
partition") {
+    withTable("spj_items", "spj_purchases") {
+      spark.sql("create table spj_items(id int, price double) using iceberg 
partitioned by (id)")
+      spark.sql("insert into spj_items values (1, 40.0), (1, 41.0), (2, 10.0), 
(3, 15.5)")
+      spark.sql(
+        "create table spj_purchases(item_id int, price double) using iceberg " 
+
+          "partitioned by (item_id)")
+      spark.sql("insert into spj_purchases values (1, 42.0), (1, 44.0), (2, 
11.0), (3, 19.5)")
+      for {
+        pushDownValues <- Seq("true", "false")
+        partiallyClustered <- Seq("true", "false")
+      } {
+        withSQLConf(
+          "spark.sql.sources.v2.bucketing.enabled" -> "true",
+          "spark.sql.requireAllClusterKeysForCoPartition" -> "false",
+          "spark.sql.adaptive.enabled" -> "false",
+          "spark.sql.iceberg.planning.preserve-data-grouping" -> "true",
+          "spark.sql.autoBroadcastJoinThreshold" -> "-1",
+          "spark.sql.optimizer.dynamicPartitionPruning.enabled" -> "true",
+          "spark.sql.optimizer.dynamicPartitionPruning.reuseBroadcastOnly" -> 
"false",
+          "spark.sql.optimizer.dynamicPartitionPruning.fallbackFilterRatio" -> 
"10",
+          "spark.sql.sources.v2.bucketing.pushPartValues.enabled" -> 
pushDownValues,
+          
"spark.sql.sources.v2.bucketing.partiallyClusteredDistribution.enabled" ->
+            partiallyClustered
+        ) {
+          // No item is priced over 50, so dynamic filtering removes every 
purchases partition.
+          val df = spark.sql(
+            "select p.price from spj_items i, spj_purchases p " +
+              "where i.id = p.item_id and i.price > 50.0")
+          assert(df.collect().isEmpty)
+          // The purchases scan is offloaded, key grouped and dynamically 
filtered.
+          assert(getExecutedPlan(df).exists {
+            case s: IcebergScanTransformer =>
+              s.getKeyGroupPartitioning.isDefined &&
+              s.runtimeFilters.exists {
+                case DynamicPruningExpression(e) => e != Literal.TrueLiteral

Review Comment:
   Nit: this writes `case DynamicPruningExpression(e) => e != 
Literal.TrueLiteral` instead of the repo-wide idiom `_ != 
DynamicPruningExpression(Literal.TrueLiteral)` used elsewhere 
(`IcebergScanTransformer.scala:315`, `BatchScanExecTransformer.scala:76`, 
Paimon variants, shim files). Semantically identical, purely stylistic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to