Skip to content

Conversation

@ajwerner
Copy link
Contributor

@ajwerner ajwerner commented Jun 8, 2022

The first commit extends the rel language with support for rules and _ and adopts it for the dep rules. The second commit contains further cleanup and adopts in op rules.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

ajwerner added 2 commits June 8, 2022 20:22
rel rules are sort of like macros which can expand variable usages to
eliminate logic duplication. They are defined per-schema. This cleans up
rules defintions quite nicely.

The _ rel.Var (aka rel.Blank) is used to indicate that a binding must occur
but that its value is not to be saved. Note that Blank cannot be used as an
entity in a query. This limitation could be lifted in the future.

Release note: None
This commit introduces nodeVars to help write rules in a cleaner way. It
associates the variable triples for element, target, and node together
in a structure.

Release note: None
@ajwerner ajwerner marked this pull request as ready for review June 9, 2022 00:27
@ajwerner ajwerner requested a review from a team June 9, 2022 00:27
Copy link

@postamar postamar left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

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


pkg/sql/schemachanger/rel/schema_rules.go line 46 at r1 (raw file):

type Rule3 = func(a, b, c Var) Clause

// Rule4 is a rule with three input variables.

nit: s/three/four

@ajwerner
Copy link
Contributor Author

ajwerner commented Jun 9, 2022

bors r+

@postamar or I will fix the comment in a separate PR.

@craig
Copy link
Contributor

craig bot commented Jun 9, 2022

Build succeeded:

@craig craig bot merged commit 7b88642 into cockroachdb:master Jun 9, 2022
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.

3 participants