pan3793 commented on code in PR #58635:
URL: https://github.com/apache/spark/pull/58635#discussion_r4520646687


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -99,6 +122,55 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] with 
PredicateHelper with J
     Filter(filter, filterApplicationSidePlan)
   }
 
+  // The aggregate that the Bloom filter's subquery evaluates over the 
creation side.
+  private def bloomFilterAggregate(filterCreationSide: FilterCreationSide): 
LogicalPlan = {
+    val filterCreationSideKey = filterCreationSide.key
+    val filterCreationSidePlan = filterCreationSide.plan
+    val rowCount = filterCreationSide.materializedRowCount
+      .orElse(filterCreationSidePlan.stats.rowCount)
+    val bloomFilterAgg =
+      if (rowCount.isDefined && rowCount.get.longValue > 0L) {
+        new BloomFilterAggregate(new XxHash64(Seq(filterCreationSideKey)), 
rowCount.get.longValue)
+      } else {
+        new BloomFilterAggregate(new XxHash64(Seq(filterCreationSideKey)))
+      }
+
+    val alias = Alias(bloomFilterAgg.toAggregateExpression(), "bloomFilter")()
+    ConstantFolding(if (filterCreationSide.hinted) {
+      pruneColumns(Aggregate(Nil, Seq(alias), filterCreationSidePlan))
+    } else {
+      ColumnPruning(Aggregate(Nil, Seq(alias), filterCreationSidePlan))
+    })
+  }
+
+  // Prunes the columns of the new subquery to a fixed point. A hinted 
creation side can have any
+  // shape, e.g. an aggregate or a window whose extra columns take more than 
one pass to remove.
+  private def pruneColumns(plan: LogicalPlan): LogicalPlan = {
+    def prune(p: LogicalPlan) = withoutUnreadOuterGenerates(ColumnPruning(p))
+    var current = plan
+    var pruned = prune(current)
+    var iteration = 1
+    while (!pruned.fastEquals(current) && iteration < 
conf.optimizerMaxIterations) {
+      current = pruned
+      pruned = prune(current)
+      iteration += 1
+    }
+    pruned
+  }
+
+  // An outer generate keeps every row of its child and only repeats some, 
which a Bloom filter
+  // does not depend on. So one whose output nothing else in the subquery 
reads is dropped, together
+  // with its generator, which column pruning keeps and which need not be 
deterministic.
+  private def withoutUnreadOuterGenerates(plan: LogicalPlan): LogicalPlan = {
+    def isRead(g: Generate): Boolean = {
+      val generated = AttributeSet(g.generatorOutput)
+      plan.exists(node => !(node eq g) && 
node.references.intersect(generated).nonEmpty)
+    }
+    plan transformDown {
+      case g: Generate if g.outer && !isRead(g) => g.child

Review Comment:
   Fixed in 9d14a7f8525 as suggested: only an outer generate over a 
non-deterministic generator is dropped. Your query is a new test with 
`checkAnswer`, AQE on and off. A regression of this PR.
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -533,71 +628,269 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] 
with PredicateHelper with J
         cannotFail(leafKey) && !reused.exists(_.exists(_.fastEquals(leaf)))
       }
     }
+    val bloomFilterEnabled = conf.runtimeFilterBloomFilterEnabled
+    lazy val cteDefs = cteDefinitions(plan)
     plan transformUp {
+      case join: Join if isRuntimeFilterHintDecided(join.hint) => join
+      // Only a hinted join has anything to do with Bloom filters disabled.
+      case join: Join if !bloomFilterEnabled && 
!hasRuntimeFilterHint(join.hint) => join
       case join @ ExtractEquiJoinKeys(joinType, leftKeys, rightKeys, _, _, 
left, right, hint) =>
         var newLeft = left
         var newRight = right
-        leftKeys.lazyZip(rightKeys).foreach((l, r) => {
-          lazy val keyDpps = dynamicPruningSubqueries(left, l) ++ 
dynamicPruningSubqueries(right, r)
-          // Check if:
-          // 1. The keys are simple cheap expressions
-          // 2. There is no DPP filter on the key that physical planning may 
keep
-          if (filterCounter < numFilterThreshold &&
-            isSimpleExpression(l) && isSimpleExpression(r) && 
!keyDpps.exists(isKept)) {
-            val oldLeft = newLeft
-            val oldRight = newRight
-            // The creation side for a bloom filter on `key` of `side`. It 
leaves out the key's own
-            // DPP filters, which physical planning drops. An expression such 
as a UDF or a `LIKE`
-            // in their build plan would also stop the search for the creation 
side, since
-            // `isSimpleExpression` sees the plan of a subquery too. If the 
key has DPP filters,
-            // they are all dropped, so step 3 above applies. The bloom filter 
evaluates its
-            // creation side again, apart from the join. Its subquery can also 
read more of that
-            // side than the join does, since filters on other keys, DPP 
filters or bloom filters,
-            // can narrow only the join's side. And the bloom filter hashes 
the bytes of the key, so
-            // its type must compare by its bytes, which a collated string 
does not.
-            def creationSide(
-                side: LogicalPlan,
-                key: Expression,
-                other: LogicalPlan,
-                otherKey: Expression): Option[FilterCreationSide] =
-              extractBeneficialFilterCreatePlan(
-                side, withoutDppFilters(other, keyDpps.contains), key, 
otherKey).filter { c =>
-                keyDpps.isEmpty || 
(UnsafeRowUtils.isBinaryStable(key.dataType) &&
-                  canPushDown(key, side) && canEvaluateAgain(c))
+        if (isRuntimeFilterHintAmbiguous(hint)) {
+          reportHintNotApplied(join,
+            "the runtime filter source is ambiguous as both join sides are 
hinted")
+        }
+        // A side hinted as the runtime filter source is the creation side, so 
the filter is
+        // applied to the other side. An ambiguous hint is ignored, leaving 
the heuristics to
+        // decide, and so is a hinted side that cannot be a runtime filter 
source on any join key.
+        val hintedSource = runtimeFilterSourceSide(hint)
+        lazy val hintCheck = hintedSource.map { side =>
+          runtimeFilterHintCheck(if (side == BuildLeft) left else right, 
cteDefs)
+        }
+        // Why the hinted side cannot prune the other side on the key pair `l` 
and `r`.
+        def hintRejection(l: Expression, r: Expression, checkFunctions: 
Boolean): Option[String] =
+          hintCheck.flatMap { check =>
+            if (hintedSource.contains(BuildRight)) check.rejection(l, r, 
checkFunctions)
+            else check.rejection(r, l, checkFunctions)
+          }
+        // The DPP filters on each key pair that prune the left side and the 
right side.
+        val keyFilters = leftKeys.lazyZip(rightKeys).map { (l, r) =>
+          (l, r, dynamicPruningFilters(left, l, r), 
dynamicPruningFilters(right, r, l))
+        }
+        def honorHint(filters: Seq[DynamicPruningSubquery]): Boolean =
+          
filters.exists(_.getTagValue(DynamicPruning.HONORS_RUNTIME_FILTER_HINT).isDefined)
+        // A key whose DPP filter honors the hint was accepted by 
[[PartitionPruning]], before a
+        // filter pushed into the hinted side could change its analysis. A 
Bloom filter's subquery
+        // is checked for the functions it calls once it is built.
+        val declinedReason = hintedSource.flatMap { side =>
+          val reasons = keyFilters.map { case (l, r, leftFilters, 
rightFilters) =>
+            if (honorHint(if (side == BuildRight) leftFilters else 
rightFilters)) None
+            else hintRejection(l, r, checkFunctions = false)
+          }
+          if (reasons.forall(_.isDefined)) reasons.head else None
+        }
+        declinedReason.foreach(reportHintNotApplied(join, _))
+        val hinted = hintedSource.isDefined && declinedReason.isEmpty
+        val injectLeftHinted = hinted && hintedSource.contains(BuildRight)
+        val injectRightHinted = hinted && hintedSource.contains(BuildLeft)
+        // The first reason the hint could not be applied on a key. The hinted 
side is the same
+        // for every key, so the first reason is as representative as any.
+        var notAppliedReason: Option[String] = None
+        def hintBlocked(reason: => String): Unit = {
+          if (notAppliedReason.isEmpty) notAppliedReason = Some(reason)
+        }
+        lazy val hasShuffle = isProbablyShuffleJoin(left, right, hint)
+        // Tries to filter `applicationSide` with a filter built from 
`creationSide`. Returns the
+        // filtered side, or `currentApplicationSide` when no filter was 
added, recording the
+        // reason when this direction is the hinted one (`isHintedDirection`). 
Requirements:
+        // 1. The application side is not a stream with a stateful operator 
(`isStatefulStream`)
+        // 2. The join type supports pruning the application side
+        // 3. The application side is not the hinted source 
(`isHintedSource`), which is never
+        //    itself filtered
+        // 4. The join is a shuffle join, or a broadcast join with a shuffle 
below it -- an
+        //    estimate of whether the filter pays off, so a hint waives it
+        // 5. There is no Bloom filter on the application side's key yet, 
unless the creation side
+        //    is hinted and the filter on the key was built from another 
creation side
+        def tryInject(
+            applicationSide: LogicalPlan,
+            currentApplicationSide: LogicalPlan,
+            applicationSideKey: Expression,
+            creationSide: LogicalPlan,
+            creationSideKey: Expression,
+            canPrune: Boolean,
+            isHintedDirection: Boolean,
+            isHintedSource: Boolean,
+            sideName: String,
+            keyDpps: Seq[DynamicPruningSubquery]): LogicalPlan = {
+          if (isStatefulStream(applicationSide)) {
+            if (isHintedDirection) {
+              hintBlocked(s"the $sideName side is a stream with a stateful 
operator")
+            }
+            currentApplicationSide
+          } else if (!canPrune) {
+            if (isHintedDirection) {
+              // `ExistenceJoin.sql` throws, as the type never appears in SQL.
+              val joinDescription = joinType match {
+                case _: ExistenceJoin => "an existence"
+                case _ => s"a ${joinType.sql.toLowerCase(Locale.ROOT)}"
               }
-            // Check if:
-            // 1. The current join type supports prune the left side with 
runtime filter
-            // 2. The current join is a shuffle join or a broadcast join that
-            //    has a shuffle below it
-            // 3. There is no bloom filter on the left key yet
-            val hasShuffle = isProbablyShuffleJoin(left, right, hint)
-            if (canPruneLeft(joinType) && (hasShuffle || 
probablyHasShuffle(left)) &&
-              !hasBloomFilter(newLeft, l)) {
-              creationSide(left, l, right, r).foreach(c => newLeft = 
injectFilter(l, newLeft, c))
+              hintBlocked(s"the $sideName side of $joinDescription join cannot 
be pruned")
+            }
+            currentApplicationSide
+          } else if (isHintedDirection) {
+            injectHintedFilter(applicationSide, currentApplicationSide, 
applicationSideKey,
+              creationSide, creationSideKey)
+          } else if (isHintedSource || !(hasShuffle || 
probablyHasShuffle(applicationSide)) ||
+              hasBloomFilter(currentApplicationSide, applicationSideKey)) {
+            currentApplicationSide
+          } else {
+            // The creation side leaves out the key's own DPP filters, which 
physical planning
+            // drops. An expression such as a UDF or a `LIKE` in their build 
plan would also stop
+            // the search for the creation side, since `isSimpleExpression` 
sees the plan of a
+            // subquery too. If the key has DPP filters, they are all dropped, 
so step 3 above
+            // applies. The bloom filter evaluates its creation side again, 
apart from the join. Its
+            // subquery can also read more of that side than the join does, 
since filters on other
+            // keys, DPP filters or bloom filters, can narrow only the join's 
side. And the bloom
+            // filter hashes the bytes of the key, so its type must compare by 
its bytes, which a
+            // collated string does not.
+            val creationPlan = if (keyDpps.isEmpty) {
+              creationSide
+            } else {
+              withoutDppFilters(creationSide, keyDpps.contains)
+            }

Review Comment:
   Fixed in 9d14a7f8525 as suggested: the creation side leaves out every 
`onlyInBroadcast` DPP filter. Your query is a new test, with Bloom filters on 
`c1` and `c2`, AQE on and off. A regression of this PR.
   



##########
sql/core/src/test/scala/org/apache/spark/sql/InjectRuntimeFilterSuite.scala:
##########
@@ -1832,6 +1911,43 @@ class InjectRuntimeFilterSuite extends SharedSparkSession
     }
   }
 
+  test("Runtime bloom filter join: add bloom filter if the dpp filter cannot 
reach the scan") {
+    
withSQLConf(SQLConf.RUNTIME_BLOOM_FILTER_APPLICATION_SIDE_SCAN_SIZE_THRESHOLD.key
 -> "3000",
+      SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "2000") {

Review Comment:
   Fixed in 9d14a7f8525 as suggested: the test turns `reuseBroadcastOnly` off, 
and its comment says why.
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -402,14 +478,19 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] with 
PredicateHelper with J
     case _ => Nil
   }
 
-  // `plan` without the DPP filters on top of it that `drop` picks, by default 
all of them.
+  // `plan` without the DPP filters that `drop` picks, by default all of them. 
This rule runs after
+  // the DPP filters are pushed down, so they can be conjuncts of any filter 
in `plan`.
   private def withoutDppFilters(
       plan: LogicalPlan,
-      drop: DynamicPruningSubquery => Boolean = _ => true): LogicalPlan = plan 
match {
-    case f @ Filter(dpp: DynamicPruningSubquery, child) =>
-      val newChild = withoutDppFilters(child, drop)
-      if (drop(dpp)) newChild else f.withNewChildren(Seq(newChild))
-    case _ => plan
+      drop: DynamicPruningSubquery => Boolean = _ => true): LogicalPlan = plan 
transform {

Review Comment:
   Fixed in 9d14a7f8525 with `transformUp`. A new test, with a broadcast whose 
build plan DPP prunes on two keys, got a Bloom filter at 558bf3e and none now. 
A regression of this PR.
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -533,71 +628,269 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] 
with PredicateHelper with J
         cannotFail(leafKey) && !reused.exists(_.exists(_.fastEquals(leaf)))
       }
     }
+    val bloomFilterEnabled = conf.runtimeFilterBloomFilterEnabled
+    lazy val cteDefs = cteDefinitions(plan)
     plan transformUp {
+      case join: Join if isRuntimeFilterHintDecided(join.hint) => join
+      // Only a hinted join has anything to do with Bloom filters disabled.
+      case join: Join if !bloomFilterEnabled && 
!hasRuntimeFilterHint(join.hint) => join
       case join @ ExtractEquiJoinKeys(joinType, leftKeys, rightKeys, _, _, 
left, right, hint) =>
         var newLeft = left
         var newRight = right
-        leftKeys.lazyZip(rightKeys).foreach((l, r) => {
-          lazy val keyDpps = dynamicPruningSubqueries(left, l) ++ 
dynamicPruningSubqueries(right, r)
-          // Check if:
-          // 1. The keys are simple cheap expressions
-          // 2. There is no DPP filter on the key that physical planning may 
keep
-          if (filterCounter < numFilterThreshold &&
-            isSimpleExpression(l) && isSimpleExpression(r) && 
!keyDpps.exists(isKept)) {
-            val oldLeft = newLeft
-            val oldRight = newRight
-            // The creation side for a bloom filter on `key` of `side`. It 
leaves out the key's own
-            // DPP filters, which physical planning drops. An expression such 
as a UDF or a `LIKE`
-            // in their build plan would also stop the search for the creation 
side, since
-            // `isSimpleExpression` sees the plan of a subquery too. If the 
key has DPP filters,
-            // they are all dropped, so step 3 above applies. The bloom filter 
evaluates its
-            // creation side again, apart from the join. Its subquery can also 
read more of that
-            // side than the join does, since filters on other keys, DPP 
filters or bloom filters,
-            // can narrow only the join's side. And the bloom filter hashes 
the bytes of the key, so
-            // its type must compare by its bytes, which a collated string 
does not.
-            def creationSide(
-                side: LogicalPlan,
-                key: Expression,
-                other: LogicalPlan,
-                otherKey: Expression): Option[FilterCreationSide] =
-              extractBeneficialFilterCreatePlan(
-                side, withoutDppFilters(other, keyDpps.contains), key, 
otherKey).filter { c =>
-                keyDpps.isEmpty || 
(UnsafeRowUtils.isBinaryStable(key.dataType) &&
-                  canPushDown(key, side) && canEvaluateAgain(c))
+        if (isRuntimeFilterHintAmbiguous(hint)) {
+          reportHintNotApplied(join,
+            "the runtime filter source is ambiguous as both join sides are 
hinted")
+        }
+        // A side hinted as the runtime filter source is the creation side, so 
the filter is
+        // applied to the other side. An ambiguous hint is ignored, leaving 
the heuristics to
+        // decide, and so is a hinted side that cannot be a runtime filter 
source on any join key.
+        val hintedSource = runtimeFilterSourceSide(hint)
+        lazy val hintCheck = hintedSource.map { side =>
+          runtimeFilterHintCheck(if (side == BuildLeft) left else right, 
cteDefs)
+        }
+        // Why the hinted side cannot prune the other side on the key pair `l` 
and `r`.
+        def hintRejection(l: Expression, r: Expression, checkFunctions: 
Boolean): Option[String] =
+          hintCheck.flatMap { check =>
+            if (hintedSource.contains(BuildRight)) check.rejection(l, r, 
checkFunctions)
+            else check.rejection(r, l, checkFunctions)
+          }
+        // The DPP filters on each key pair that prune the left side and the 
right side.
+        val keyFilters = leftKeys.lazyZip(rightKeys).map { (l, r) =>
+          (l, r, dynamicPruningFilters(left, l, r), 
dynamicPruningFilters(right, r, l))
+        }
+        def honorHint(filters: Seq[DynamicPruningSubquery]): Boolean =
+          
filters.exists(_.getTagValue(DynamicPruning.HONORS_RUNTIME_FILTER_HINT).isDefined)
+        // A key whose DPP filter honors the hint was accepted by 
[[PartitionPruning]], before a
+        // filter pushed into the hinted side could change its analysis. A 
Bloom filter's subquery
+        // is checked for the functions it calls once it is built.
+        val declinedReason = hintedSource.flatMap { side =>
+          val reasons = keyFilters.map { case (l, r, leftFilters, 
rightFilters) =>
+            if (honorHint(if (side == BuildRight) leftFilters else 
rightFilters)) None
+            else hintRejection(l, r, checkFunctions = false)
+          }
+          if (reasons.forall(_.isDefined)) reasons.head else None
+        }
+        declinedReason.foreach(reportHintNotApplied(join, _))
+        val hinted = hintedSource.isDefined && declinedReason.isEmpty
+        val injectLeftHinted = hinted && hintedSource.contains(BuildRight)
+        val injectRightHinted = hinted && hintedSource.contains(BuildLeft)
+        // The first reason the hint could not be applied on a key. The hinted 
side is the same
+        // for every key, so the first reason is as representative as any.
+        var notAppliedReason: Option[String] = None
+        def hintBlocked(reason: => String): Unit = {
+          if (notAppliedReason.isEmpty) notAppliedReason = Some(reason)
+        }
+        lazy val hasShuffle = isProbablyShuffleJoin(left, right, hint)
+        // Tries to filter `applicationSide` with a filter built from 
`creationSide`. Returns the
+        // filtered side, or `currentApplicationSide` when no filter was 
added, recording the
+        // reason when this direction is the hinted one (`isHintedDirection`). 
Requirements:
+        // 1. The application side is not a stream with a stateful operator 
(`isStatefulStream`)
+        // 2. The join type supports pruning the application side
+        // 3. The application side is not the hinted source 
(`isHintedSource`), which is never
+        //    itself filtered
+        // 4. The join is a shuffle join, or a broadcast join with a shuffle 
below it -- an
+        //    estimate of whether the filter pays off, so a hint waives it
+        // 5. There is no Bloom filter on the application side's key yet, 
unless the creation side
+        //    is hinted and the filter on the key was built from another 
creation side
+        def tryInject(
+            applicationSide: LogicalPlan,
+            currentApplicationSide: LogicalPlan,
+            applicationSideKey: Expression,
+            creationSide: LogicalPlan,
+            creationSideKey: Expression,
+            canPrune: Boolean,
+            isHintedDirection: Boolean,
+            isHintedSource: Boolean,
+            sideName: String,
+            keyDpps: Seq[DynamicPruningSubquery]): LogicalPlan = {
+          if (isStatefulStream(applicationSide)) {
+            if (isHintedDirection) {
+              hintBlocked(s"the $sideName side is a stream with a stateful 
operator")
+            }
+            currentApplicationSide
+          } else if (!canPrune) {
+            if (isHintedDirection) {
+              // `ExistenceJoin.sql` throws, as the type never appears in SQL.
+              val joinDescription = joinType match {
+                case _: ExistenceJoin => "an existence"
+                case _ => s"a ${joinType.sql.toLowerCase(Locale.ROOT)}"
               }
-            // Check if:
-            // 1. The current join type supports prune the left side with 
runtime filter
-            // 2. The current join is a shuffle join or a broadcast join that
-            //    has a shuffle below it
-            // 3. There is no bloom filter on the left key yet
-            val hasShuffle = isProbablyShuffleJoin(left, right, hint)
-            if (canPruneLeft(joinType) && (hasShuffle || 
probablyHasShuffle(left)) &&
-              !hasBloomFilter(newLeft, l)) {
-              creationSide(left, l, right, r).foreach(c => newLeft = 
injectFilter(l, newLeft, c))
+              hintBlocked(s"the $sideName side of $joinDescription join cannot 
be pruned")
+            }
+            currentApplicationSide
+          } else if (isHintedDirection) {
+            injectHintedFilter(applicationSide, currentApplicationSide, 
applicationSideKey,
+              creationSide, creationSideKey)
+          } else if (isHintedSource || !(hasShuffle || 
probablyHasShuffle(applicationSide)) ||
+              hasBloomFilter(currentApplicationSide, applicationSideKey)) {
+            currentApplicationSide
+          } else {
+            // The creation side leaves out the key's own DPP filters, which 
physical planning
+            // drops. An expression such as a UDF or a `LIKE` in their build 
plan would also stop
+            // the search for the creation side, since `isSimpleExpression` 
sees the plan of a
+            // subquery too. If the key has DPP filters, they are all dropped, 
so step 3 above
+            // applies. The bloom filter evaluates its creation side again, 
apart from the join. Its
+            // subquery can also read more of that side than the join does, 
since filters on other
+            // keys, DPP filters or bloom filters, can narrow only the join's 
side. And the bloom
+            // filter hashes the bytes of the key, so its type must compare by 
its bytes, which a
+            // collated string does not.
+            val creationPlan = if (keyDpps.isEmpty) {
+              creationSide
+            } else {
+              withoutDppFilters(creationSide, keyDpps.contains)
+            }
+            extractBeneficialFilterCreatePlan(
+              applicationSide, creationPlan, applicationSideKey, 
creationSideKey)
+              .filter(c => keyDpps.isEmpty ||
+                (UnsafeRowUtils.isBinaryStable(applicationSideKey.dataType) &&
+                  canPushDown(applicationSideKey, applicationSide) && 
canEvaluateAgain(c)))
+              .map(injectFilter(applicationSideKey, currentApplicationSide, _))
+              .getOrElse(currentApplicationSide)
+          }
+        }
+        // Filters `applicationSide` with a Bloom filter built from the hinted 
`creationSide`.
+        def injectHintedFilter(
+            applicationSide: LogicalPlan,
+            currentApplicationSide: LogicalPlan,
+            applicationSideKey: Expression,
+            creationSide: LogicalPlan,
+            creationSideKey: Expression): LogicalPlan = {
+          lazy val creation = FilterCreationSide(
+            creationSideKey, creationSide, useMaterializedThreshold = false, 
hinted = true)
+          if (!UnsafeRowUtils.isBinaryStable(applicationSideKey.dataType) ||
+              !UnsafeRowUtils.isBinaryStable(creationSideKey.dataType)) {
+            // The Bloom filter hashes the bytes of a key, which a collation 
can compare as equal
+            // to other bytes (SPARK-58486).
+            hintBlocked("the join key has a collation the Bloom filter hash 
does not follow")
+            currentApplicationSide
+          } else if (hasBloomFilter(currentApplicationSide, 
applicationSideKey) &&

Review Comment:
   Fixed in 9d14a7f8525 as suggested; the reason covers both checks of 
`canPushDown`. A new test has a Python UDF on the hinted side and `CAST(p.f5 AS 
TINYINT)` as the key, in ANSI mode. A regression of this PR.
   



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