Skip to content

opt: implement PlanGram parser#169197

Open
michae2 wants to merge 1 commit intocockroachdb:masterfrom
michae2:plangram-parse
Open

opt: implement PlanGram parser#169197
michae2 wants to merge 1 commit intocockroachdb:masterfrom
michae2:plangram-parse

Conversation

@michae2
Copy link
Copy Markdown
Collaborator

@michae2 michae2 commented Apr 27, 2026

Implement ParsePlanGram, a recursive-descent parser with 1-token lookahead for plangram grammars. The parser reads from an io.Reader using bufio.Scanner with a custom SplitFunc.

A reverse-lookup function OperatorByCamelCase is added to the optgen code generator to map camel-case operator names (e.g. "InnerJoin") back to opt.Operator values during parsing.

Informs: #152053

Release note: None

Co-Authored-By: roachdev-claude roachdev-claude-bot@cockroachlabs.com

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Apr 27, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@michae2 michae2 force-pushed the plangram-parse branch 5 times, most recently from 6c53995 to 96c1406 Compare May 5, 2026 00:33
@michae2 michae2 requested review from a team, DrewKimball and ZhouXing19 May 5, 2026 00:34
@michae2 michae2 marked this pull request as ready for review May 5, 2026 00:34
@michae2
Copy link
Copy Markdown
Collaborator Author

michae2 commented May 5, 2026

This parser is based on the one in master...michae2:cockroach:pheromone but with some cleanup from Claude. Being able to parse plangrams makes testcases simpler, and will come in handy if one day we want to use them directly.

Copy link
Copy Markdown
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: Cool!

@DrewKimball reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on ZhouXing19).

Implement ParsePlanGram, a recursive-descent parser with 1-token
lookahead for plangram grammars. The parser reads from an io.Reader
using bufio.Scanner with a custom SplitFunc.

A reverse-lookup function OperatorByCamelCase is added to the optgen
code generator to map camel-case operator names (e.g. "InnerJoin") back
to opt.Operator values during parsing.

Informs: cockroachdb#152053

Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
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