peter-toth commented on a change in pull request #32298:
URL: https://github.com/apache/spark/pull/32298#discussion_r834760177
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BloomFilterMightContain.scala
##########
@@ -56,6 +56,9 @@ case class BloomFilterMightContain(
case e : Expression if e.foldable => TypeCheckResult.TypeCheckSuccess
case subquery : PlanExpression[_] if
!subquery.containsPattern(OUTER_REFERENCE) =>
TypeCheckResult.TypeCheckSuccess
+ case GetStructField(subquery: PlanExpression[_], _, _)
Review comment:
This is because with this PR some bloom filter aggregate subqueries can
be merged. E.g.
```
Join Inner, ((c1#45920 = c2#45926) AND (b1#45919 = b2#45925))
:- Filter might_contain(scalar-subquery#45986 [], xxhash64(b1#45919, 42))
: : +- Aggregate [bloom_filter_agg(xxhash64(b2#45925, 42), 1000000,
8388608, 0, 0) AS bloomFilter#45985]
: : +- Filter ((isnotnull(a2#45924) AND (a2#45924 = 62)) AND
(isnotnull(c2#45926) AND isnotnull(b2#45925)))
: : +- Relation
default.bf2[a2#45924,b2#45925,c2#45926,d2#45927,e2#45928,f2#45929] parquet
: +- Filter might_contain(scalar-subquery#45983 [], xxhash64(c1#45920, 42))
: : +- Aggregate [bloom_filter_agg(xxhash64(c2#45926, 42), 1000000,
8388608, 0, 0) AS bloomFilter#45982]
: : +- Filter ((isnotnull(a2#45924) AND (a2#45924 = 62)) AND
(isnotnull(c2#45926) AND isnotnull(b2#45925)))
: : +- Relation
default.bf2[a2#45924,b2#45925,c2#45926,d2#45927,e2#45928,f2#45929] parquet
: +- Filter (isnotnull(c1#45920) AND isnotnull(b1#45919))
: +- Relation
default.bf1[a1#45918,b1#45919,c1#45920,d1#45921,e1#45922,f1#45923] parquet
+- Filter ((isnotnull(a2#45924) AND (a2#45924 = 62)) AND
(isnotnull(c2#45926) AND isnotnull(b2#45925)))
+- Relation
default.bf2[a2#45924,b2#45925,c2#45926,d2#45927,e2#45928,f2#45929] parquet
```
=>
```
WithCTE
:- CTERelationDef 0
: +- Project [named_struct(bloomFilter, bloomFilter#45985, bloomFilter,
bloomFilter#45982) AS mergedValue#45989]
: +- Aggregate [bloom_filter_agg(xxhash64(b2#45925, 42), 1000000,
8388608, 0, 0) AS bloomFilter#45985, bloom_filter_agg(xxhash64(c2#45926, 42),
1000000, 8388608, 0, 0) AS bloomFilter#45982]
: +- Filter ((isnotnull(a2#45924) AND (a2#45924 = 62)) AND
(isnotnull(c2#45926) AND isnotnull(b2#45925)))
: +- Relation
default.bf2[a2#45924,b2#45925,c2#45926,d2#45927,e2#45928,f2#45929] parquet
+- Join Inner, ((c1#45920 = c2#45926) AND (b1#45919 = b2#45925))
:- Filter might_contain(scalar-subquery#45986 [].bloomFilter,
xxhash64(b1#45919, 42))
: : +- CTERelationRef 0, true, [mergedValue#45989], true
: +- Filter might_contain(scalar-subquery#45983 [].bloomFilter,
xxhash64(c1#45920, 42))
: : +- CTERelationRef 0, true, [mergedValue#45989], true
: +- Filter (isnotnull(c1#45920) AND isnotnull(b1#45919))
: +- Relation
default.bf1[a1#45918,b1#45919,c1#45920,d1#45921,e1#45922,f1#45923] parquet
+- Filter ((isnotnull(a2#45924) AND (a2#45924 = 62)) AND
(isnotnull(c2#45926) AND isnotnull(b2#45925)))
+- Relation
default.bf2[a2#45924,b2#45925,c2#45926,d2#45927,e2#45928,f2#45929] parquet
```
--
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]