Skip to content

sql: refactor PlanCDCExpression#143463

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
mgartner:remove-cdc-walk-plan
Mar 26, 2025
Merged

sql: refactor PlanCDCExpression#143463
craig[bot] merged 3 commits intocockroachdb:masterfrom
mgartner:remove-cdc-walk-plan

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Mar 26, 2025

sql: collect CDC presentation outside of plan walker

The column presentation of the top node is collected to determine the
output columns for the CDC expression. There is no need to do this
within the plan node walker, so it has been moved outside.

Release note: None

sql: use InputCount and Input planNode methods to walk CDC plans

The Input and InputCount methods of the planNode interface are now
used to walk plan node trees of CDC expressions. This continues the
effort to deprecate and remove the plan node walkers (see #137620 for
more details on the motivation for this).

Epic: None
Release note: None

sql: refactor return statements in PlanCDCExpression

The return statements for error cases now explicitly return an empty
CDCExpressionPlan for clarity.

Release note: None

@mgartner mgartner requested review from a team and asg0451 March 26, 2025 00:14
@mgartner mgartner requested a review from a team as a code owner March 26, 2025 00:14
@mgartner mgartner requested review from yuzefovich and removed request for a team March 26, 2025 00:14
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Mar 26, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@mgartner mgartner force-pushed the remove-cdc-walk-plan branch from 836109e to 400767c Compare March 26, 2025 00:27
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asg0451)


pkg/sql/distsql_plan_changefeed.go line 136 at r1 (raw file):

	// Walk the plan, perform sanity checks and extract information we need.
	var spans roachpb.Spans
	var presentation colinfo.ResultColumns

nit: presentation variable here should be removed in the first commit, not in the second, otherwise the first commit doesn't compile, right?

The column presentation of the top node is collected to determine the
output columns for the CDC expression. There is no need to do this
within the plan node walker, so it has been moved outside.

Release note: None
The `Input` and `InputCount` methods of the `planNode` interface are now
used to walk plan node trees of CDC expressions. This continues the
effort to deprecate and remove the plan node walkers (see cockroachdb#137620 for
more details on the motivation for this).

Release note: None
The `return` statements for error cases now explicitly return an empty
`CDCExpressionPlan` for clarity.

Release note: None
@mgartner mgartner force-pushed the remove-cdc-walk-plan branch from 400767c to 518b3fa Compare March 26, 2025 13:48
Copy link
Copy Markdown
Contributor Author

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @asg0451 and @yuzefovich)


pkg/sql/distsql_plan_changefeed.go line 136 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: presentation variable here should be removed in the first commit, not in the second, otherwise the first commit doesn't compile, right?

Great catch! Fixed.

@mgartner
Copy link
Copy Markdown
Contributor Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 26, 2025

@craig craig bot merged commit f66151f into cockroachdb:master Mar 26, 2025
24 checks passed
@mgartner mgartner deleted the remove-cdc-walk-plan branch March 26, 2025 17:18
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.

3 participants