Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: fix recent regression in EXPLAIN ANALYZE #143088

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Mar 18, 2025

This commit fixes a regression in EXPLAIN ANALYZE output recently added in 44da781. Before that change we always performed the association of the current planNode with the last stage of the physical plan, and after that change we started doing the association only when a new stage is added. However, this resulted in missing associations when a particular planNode didn't result in a new stage of the physical plan (for example, renderNode is handled as a projection by adjusting PostProcessSpec of already existing stage). As a result, we could lose the ability to associate execution statistics to some nodes in EXPLAIN ANALYZE output.

This is now fixed by bringing back the unconditional call to associate the current planNode with the last stage of the physical plan, even if a new stage isn't added. This required teaching associateNodeWithComponents to "swallow" duplicate associations and make them no-ops (otherwise, we would double-count statistics in some cases).

Epic: None
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

This commit fixes a regression in EXPLAIN ANALYZE output recently added
in 44da781. Before that change we
always performed the association of the current planNode with the last
stage of the physical plan, and after that change we started doing the
association only when a new stage is added. However, this resulted in
missing associations when a particular planNode didn't result in a new
stage of the physical plan (for example, renderNode is handled as
a projection by adjusting PostProcessSpec of already existing stage). As
a result, we could lose the ability to associate execution statistics to
some nodes in EXPLAIN ANALYZE output.

This is now fixed by bringing back the unconditional call to associate the
current planNode with the last stage of the physical plan, even if a new
stage isn't added. This required teaching `associateNodeWithComponents`
to "swallow" duplicate associations and make them no-ops (otherwise, we
would double-count statistics in some cases).

Release note: None
@yuzefovich yuzefovich requested a review from DrewKimball March 18, 2025 21:18
@yuzefovich yuzefovich marked this pull request as ready for review March 18, 2025 21:18
@yuzefovich yuzefovich requested a review from a team as a code owner March 18, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants