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/sem/builtins: move definitions map to new package #84360

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

ajwerner
Copy link
Contributor

@ajwerner ajwerner commented Jul 13, 2022

Previously, the definition of builtin functions live in the builtins
package. This was undesirable because various other packages need to
acceess builtins properties by name, but it has a been a headache to
achieve this without importing the builtins package, which stands
pretty high in the dependecy chain (e.g. seqexpr, memo).

This PR moves builtins definition into a new registry package that the
builtins package calls to register builtin functions, which happens
in the init() function. This way, other lower level packages, who
wish to access builtins properties, need only to import the newly
created builtinsregistry package.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, the definition of builtin functions live in the `builtins`
package. This was undesirable because various other packages need to
acceess builtins properties by name, but it has a been a headache to
achieve this without importing the `builtins` package, which stands
pretty high in the dependecy chain (e.g. `seqexpr`, `memo`).

This PR moves builtins definition into a new registry package that the
`builtins` package calls to register builtin functions, which happens
in the `init()` function. This way, other lower level packages, who
wish to access builtins properties, need only to import the newly
created `builtinsregistry` package.

Release note: None
@Xiang-Gu Xiang-Gu force-pushed the ajwerner/builtin-registry branch from 6b3dd3f to cee2f34 Compare July 13, 2022 18:36
@ajwerner
Copy link
Contributor Author

@chengxiong-ruan can you take a look at this. It's a little bit gross in that tree has a map that almost has what we want already, so externalizing this second one in a new package may lead to yet more confusion, but it's not really any worse than what we have now and it solves some thorny dependency problems.

Copy link
Contributor

@chengxiong-ruan chengxiong-ruan left a comment

Choose a reason for hiding this comment

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

LGTM!

@Xiang-Gu Xiang-Gu marked this pull request as ready for review July 13, 2022 21:45
@Xiang-Gu Xiang-Gu requested review from a team July 13, 2022 21:45
@Xiang-Gu Xiang-Gu requested review from a team as code owners July 13, 2022 21:45
@Xiang-Gu
Copy link
Contributor

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 13, 2022

Build succeeded:

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