peter-toth commented on code in PR #32298:
URL: https://github.com/apache/spark/pull/32298#discussion_r858597411


##########
sql/core/src/test/scala/org/apache/spark/sql/InjectRuntimeFilterSuite.scala:
##########
@@ -264,28 +264,25 @@ class InjectRuntimeFilterSuite extends QueryTest with 
SQLTestUtils with SharedSp
     }
   }
 
-  def getNumBloomFilters(plan: LogicalPlan): Integer = {
-    val numBloomFilterAggs = plan.collect {
-      case Filter(condition, _) => condition.collect {
-        case subquery: org.apache.spark.sql.catalyst.expressions.ScalarSubquery
-        => subquery.plan.collect {
-          case Aggregate(_, aggregateExpressions, _) =>
-            aggregateExpressions.map {
-              case Alias(AggregateExpression(bfAgg : BloomFilterAggregate, _, 
_, _, _),
-              _) =>
-                assert(bfAgg.estimatedNumItemsExpression.isInstanceOf[Literal])
-                assert(bfAgg.numBitsExpression.isInstanceOf[Literal])
-                1
-            }.sum
+  // `MergeScalarSubqueries` can duplicate subqueries in the optimized plan, 
but the subqueries will

Review Comment:
   But, isn't it beneficial that bloom filter subqueries can be merged? Here 
was an example: 
https://github.com/apache/spark/pull/32298/files/2590edf74f78096249b31dffae6ff94f293fc78d#r834760177
 
   
   Actually, after https://github.com/apache/spark/pull/34929 the final 
optimized plan will not contain any `WithCTE` nodes (the subqueries will be in 
under the `Filter` node) so we can revert this change, but I think the new 
`scalarSubqueryCTEMultiplicator` param in the final assert is still needed.
   



-- 
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