Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Java: Fix accidental CP in CFG for asserts.#20091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
aschackmull wants to merge1 commit intogithub:main
base:main
Choose a base branch
Loading
fromaschackmull:java/fix-cfg-cp-assert

Conversation

aschackmull
Copy link
Contributor

The somewhat recent change to the CFG for Java assert statements introduced an accidental cartesian product. The product is between completions and assert statements, both of which are somewhat limited in number, which is why we haven't discovered this before now. It was identified by the join-order metric, since the CP was confusing the optimiser to select a particularly bad join order.

Before:

              444   ~4%    {2} r34 = JOIN Completion::Completion#3da5aa6a WITH num#Completion::NormalCompletion#17a01869 CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0        257653644   ~0%    {3}    | JOIN WITH `ControlFlowGraph::ControlFlowGraphImpl::last/3#f72f2d15_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2            17760   ~0%    {3}    | JOIN WITH `Statement::AssertStmt.getMessage/0#dispred#911385b1_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2            17760   ~0%    {3}    | JOIN WITH num#ControlFlowGraph::ControlFlow::TAssertThrowNode#fd4ea142 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1

After:

[2025-07-18 13:46:42] Evaluated non-recursive predicate _ControlFlowGraph::ControlFlowGraphImpl::last/3#f72f2d15_201#join_rhs_num#Completion::NormalCompleti__#shared@4f47f1qe in 92ms (size: 580301).Evaluated relational algebra for predicate _ControlFlowGraph::ControlFlowGraphImpl::last/3#f72f2d15_201#join_rhs_num#Completion::NormalCompleti__#shared@4f47f1qe with tuple counts:        580301  ~1%    {3} r1 = JOIN `ControlFlowGraph::ControlFlowGraphImpl::last/3#f72f2d15_201#join_rhs` WITH num#Completion::NormalCompletion#17a01869 ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2                       return r1...            40   ~3%    {3} r4 = JOIN `_ControlFlowGraph::ControlFlowGraphImpl::last/3#f72f2d15_201#join_rhs_num#Completion::NormalCompleti__#shared` WITH `Statement::AssertStmt.getMessage/0#dispred#911385b1_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2            40   ~0%    {3}    | JOIN WITH num#ControlFlowGraph::ControlFlow::TAssertThrowNode#fd4ea142 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1

@CopilotCopilotAI review requested due to automatic review settingsJuly 18, 2025 12:00
@aschackmullaschackmull requested a review froma team as acode ownerJuly 18, 2025 12:00
@aschackmullaschackmull added the no-change-note-requiredThis PR does not need a change note labelJul 18, 2025
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR fixes an accidental cartesian product in the control flow graph (CFG) implementation for Java assert statements. The issue was causing the query optimizer to select inefficient join orders, significantly impacting performance.

  • Replaces direct pattern matching withNormalCompletion() with explicit variable binding and constraint
  • Eliminates cartesian product between completions and assert statements in the query execution plan
  • Improves query performance by enabling better join order selection

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@owen-mcowen-mcowen-mc approved these changes

Assignees
No one assigned
Labels
Javano-change-note-requiredThis PR does not need a change note
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@aschackmull@owen-mc

[8]ページ先頭

©2009-2025 Movatter.jp