Skip to content

Collect multiple optimizer hints per statement and extract comment pr…#2

Merged
altmannmarcelo merged 1 commit into
readysettech:readyset-patchedfrom
altmannmarcelo:extend_optimizer_hints
Feb 13, 2026
Merged

Collect multiple optimizer hints per statement and extract comment pr…#2
altmannmarcelo merged 1 commit into
readysettech:readyset-patchedfrom
altmannmarcelo:extend_optimizer_hints

Conversation

@altmannmarcelo
Copy link
Copy Markdown

…efix

Two orthogonal improvements to optimizer hint parsing:

  1. Option<OptimizerHint> -> Vec<OptimizerHint>: the old Option silently dropped all but the first hint-style comment. Vec preserves all hint comments the parser encounters, letting consumers decide which to use. This is backwards compatible: optimizer_hint: None becomes optimizer_hints: vec![], and optimizer_hint.unwrap() becomes optimizer_hints[0].

  2. Generic prefix extraction: the /*+...*/ pattern is an established convention. Various systems extend it with /*prefix+...*/ where the prefix is opaque alphanumeric text before +. Rather than adding a new dialect flag or struct for each system, the parser now captures any [a-zA-Z0-9]* run before + as a prefix field. Standard hints have prefix: "". No new dialect surface -- same supports_comment_optimizer_hint() gate. This makes OptimizerHint a generic extension point: downstream consumers can define their own prefixed hint conventions and filter hints by prefix, without requiring any changes to the parser or dialect configuration.

@altmannmarcelo altmannmarcelo force-pushed the extend_optimizer_hints branch 2 times, most recently from 3c9941c to d374c90 Compare February 12, 2026 23:46
Copy link
Copy Markdown
Collaborator

@mvzink mvzink left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/ast/dml.rs Outdated
…efix

Two orthogonal improvements to optimizer hint parsing:

1. `Option<OptimizerHint>` -> `Vec<OptimizerHint>`: the old Option silently
   dropped all but the first hint-style comment. Vec preserves all hint
   comments the parser encounters, letting consumers decide which to use.
   This is backwards compatible: `optimizer_hint: None` becomes
   `optimizer_hints: vec![]`, and `optimizer_hint.unwrap()` becomes
   `optimizer_hints[0]`.

2. Generic prefix extraction: the `/*+...*/` pattern is an established
   convention. Various systems extend it with `/*prefix+...*/` where the
   prefix is opaque alphanumeric text before `+`. Rather than adding a new
   dialect flag or struct for each system, the parser now captures any
   `[a-zA-Z0-9]*` run before `+` as a `prefix` field. Standard hints have
   `prefix: ""`. No new dialect surface -- same `supports_comment_optimizer_hint()`
   gate. This makes OptimizerHint a generic extension point: downstream
   consumers can define their own prefixed hint conventions and filter hints
   by prefix, without requiring any changes to the parser or dialect
   configuration.
@altmannmarcelo altmannmarcelo merged commit f287484 into readysettech:readyset-patched Feb 13, 2026
1 check passed
@altmannmarcelo altmannmarcelo deleted the extend_optimizer_hints branch February 13, 2026 10:17
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.

2 participants