Skip to content

Conversation

silverbullet233
Copy link
Contributor

@silverbullet233 silverbullet233 commented Aug 20, 2025

Why I'm doing:

What I'm doing:

in this pr, I support expression reuse strategy on outer join's where predicates, just like what we do in scan predicates(#52889).

currently, this optimization applies to hash/nest loop outer joins.
For inner joins, both where and on predicates appear in the PhysicalJoinOperator's onPredicate , rather than predicates . I'm concerned that splitting the onPredicate clause might introduce additional risks, so I didn't do it in this pr, we can support this in the future if needed.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

@alvin-celerdata
Copy link
Contributor

@cursor review

LiShuMing
LiShuMing previously approved these changes Aug 28, 2025
satanson
satanson previously approved these changes Aug 28, 2025
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Copy link

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 49 / 49 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/optimizer/validate/InputDependenciesChecker.java 2 2 100.00% []
🔵 com/starrocks/sql/optimizer/rule/tree/exprreuse/ScalarOperatorsReuseRule.java 6 6 100.00% []
🔵 com/starrocks/sql/optimizer/operator/scalar/DictMappingOperator.java 1 1 100.00% []
🔵 com/starrocks/planner/HashJoinNode.java 2 2 100.00% []
🔵 com/starrocks/sql/plan/PlanFragmentBuilder.java 27 27 100.00% []
🔵 com/starrocks/planner/JoinNode.java 8 8 100.00% []
🔵 com/starrocks/planner/NestLoopJoinNode.java 3 3 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 89 / 89 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/hash_joiner.h 2 2 100.00% []
🔵 be/src/exec/pipeline/hashjoin/hash_joiner_factory.cpp 3 3 100.00% []
🔵 be/src/exprs/expr.cpp 13 13 100.00% []
🔵 be/src/storage/chunk_helper.cpp 13 13 100.00% []
🔵 be/src/exec/pipeline/nljoin/nljoin_probe_operator.cpp 24 24 100.00% []
🔵 be/src/exec/pipeline/nljoin/spillable_nljoin_probe_operator.h 1 1 100.00% []
🔵 be/src/exec/cross_join_node.cpp 9 9 100.00% []
🔵 be/src/exec/hash_joiner.cpp 10 10 100.00% []
🔵 be/src/exec/hash_join_node.cpp 6 6 100.00% []
🔵 be/src/exec/pipeline/nljoin/nljoin_probe_operator.h 1 1 100.00% []
🔵 be/src/exec/pipeline/nljoin/spillable_nljoin_probe_operator.cpp 7 7 100.00% []

@silverbullet233 silverbullet233 enabled auto-merge (squash) August 29, 2025 01:41
@silverbullet233 silverbullet233 merged commit 6c220d0 into StarRocks:main Aug 29, 2025
80 of 84 checks passed
@silverbullet233 silverbullet233 deleted the join_predicate_reuse branch August 29, 2025 03:19
@silverbullet233
Copy link
Contributor Author

@mergify backport branch-3.5 branch-4.0

Copy link
Contributor

mergify bot commented Sep 2, 2025

backport branch-3.5 branch-4.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 2, 2025
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
(cherry picked from commit 6c220d0)

# Conflicts:
#	be/src/exec/hash_join_node.cpp
#	be/src/exec/hash_joiner.h
mergify bot pushed a commit that referenced this pull request Sep 2, 2025
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
(cherry picked from commit 6c220d0)
silverbullet233 added a commit that referenced this pull request Sep 2, 2025
…port #62139) (#62624)

Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Co-authored-by: eyes_on_me <nopainnofame@sina.com>
Co-authored-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Nboxff pushed a commit to Nboxff/starrocks that referenced this pull request Sep 8, 2025
…Rocks#62139)

Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants