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: refactor tree.RoutineExpr #95885

Merged
merged 1 commit into from
Jan 27, 2023
Merged

Conversation

mgartner
Copy link
Collaborator

@mgartner mgartner commented Jan 25, 2023

tree.RoutineExpr no longer tracks the number of statements in the
routine. Instead, it has a tree.RoutinePlanGenerator that generates a
plan for each statement in the routine, given a list of arguments, and
invokes a given callback on the plan.

Epic: None

Release note: None

@mgartner mgartner requested review from a team as code owners January 25, 2023 23:54
@blathers-crl
Copy link

blathers-crl bot commented Jan 25, 2023

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
Member

This change is Reviewable

Copy link
Collaborator

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)

Copy link
Collaborator

@DrewKimball DrewKimball 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 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)


pkg/sql/sem/tree/routine.go line 32 at r1 (raw file):

// by a RoutinePlanGenerator. isFinalPlan is true if no more plans will be
// generated.
type RoutinePlanEnumerator func(plan RoutinePlan, isFinalPlan bool) error

[super nit] I'm not sure RoutinePlanEnumerator makes sense to me here, since it isn't doing the enumerating. Maybe something like RoutinePlanExecutor?

Copy link
Collaborator 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! 2 of 0 LGTMs obtained (waiting on @DrewKimball)


pkg/sql/sem/tree/routine.go line 32 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

[super nit] I'm not sure RoutinePlanEnumerator makes sense to me here, since it isn't doing the enumerating. Maybe something like RoutinePlanExecutor?

Good point. How about RoutinePlanGeneratedFunc? I'm steering away from Executor because it assumes that they plan will be executed - but it doesn't have to be - the caller using the generator can do what they will with the plans.

Copy link
Collaborator

@DrewKimball DrewKimball 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 2 stale) (waiting on @mgartner)


pkg/sql/sem/tree/routine.go line 32 at r1 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

Good point. How about RoutinePlanGeneratedFunc? I'm steering away from Executor because it assumes that they plan will be executed - but it doesn't have to be - the caller using the generator can do what they will with the plans.

I like that better. Another option could be Handler, but I'm ok with either of those.

@mgartner mgartner force-pushed the routine-generator branch 2 times, most recently from 982cb7e to 69825d9 Compare January 26, 2023 21:53
`tree.RoutineExpr` no longer tracks the number of statements in the
routine. Instead, it has a `tree.RoutinePlanGenerator` that generates a
plan for each statement in the routine, given a list of arguments, and
invokes a given callback on the plan.

Release note: None
@mgartner
Copy link
Collaborator Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 27, 2023

Build succeeded:

@craig craig bot merged commit ea0d772 into cockroachdb:master Jan 27, 2023
@mgartner mgartner deleted the routine-generator branch January 27, 2023 15:34
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.

4 participants