beliefer commented on code in PR #42317:
URL: https://github.com/apache/spark/pull/42317#discussion_r1356628270
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -139,41 +160,68 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] with
PredicateHelper with J
referencedExprs.map(_.references).foldLeft(AttributeSet.empty)(_
++ _),
hasHitFilter,
hasHitSelectiveFilter,
- currentPlan)
+ targetPlan,
+ targetCreationSideExpr)
} else {
None
}
case Project(_, child) =>
assert(predicateReference.isEmpty && !hasHitSelectiveFilter)
- extract(child, predicateReference, hasHitFilter,
hasHitSelectiveFilter, currentPlan)
+ extract(child, predicateReference, hasHitFilter,
hasHitSelectiveFilter, targetPlan,
+ targetCreationSideExpr)
case Filter(condition, child) if isSimpleExpression(condition) =>
extract(
child,
predicateReference ++ condition.references,
hasHitFilter = true,
hasHitSelectiveFilter = hasHitSelectiveFilter ||
isLikelySelective(condition),
- currentPlan)
- case ExtractEquiJoinKeys(_, _, _, _, _, left, right, _) =>
+ targetPlan,
+ targetCreationSideExpr)
+ case ExtractEquiJoinKeys(_, lkeys, rkeys, _, _, left, right, _) =>
// Runtime filters use one side of the [[Join]] to build a set of join
key values and prune
// the other side of the [[Join]]. It's also OK to use a superset of
the join key values
// (ignore null values) to do the pruning.
- if (left.output.exists(_.semanticEquals(filterCreationSideExp))) {
- extract(left, AttributeSet.empty,
- hasHitFilter = false, hasHitSelectiveFilter = false, currentPlan =
left)
- } else if
(right.output.exists(_.semanticEquals(filterCreationSideExp))) {
- extract(right, AttributeSet.empty,
- hasHitFilter = false, hasHitSelectiveFilter = false, currentPlan =
right)
+ if (left.output.exists(_.semanticEquals(targetCreationSideExpr))) {
+ val extracted = extract(left, AttributeSet.empty,
+ hasHitFilter = false, hasHitSelectiveFilter = false, targetPlan =
left,
+ targetCreationSideExpr = targetCreationSideExpr)
Review Comment:
Yeah. Let's use `OrElse`.
--
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]