Skip to content

Snowflake: preserve reluctant MATCH_RECOGNIZE quantifiers - #2510

Open
osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:snowflake-match-recognize-reluctant
Open

osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:snowflake-match-recognize-reluctant

Conversation

@osipovartem

@osipovartem osipovartem commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Preserves the reluctant modifier on Snowflake/SQL MATCH_RECOGNIZE quantifiers. Previously, A*? was represented as (A*)?, changing a reluctant zero-or-more quantifier into a nested optional repetition.

The AST now represents this as Repetition(A, Reluctant(ZeroOrMore)). Existing Repetition(pattern, quantifier) construction remains unchanged, while the added Reluctant quantifier wrapper also covers +?, ??, and range forms such as {2,4}?. Stacked quantifiers that are not the single reluctant suffix are rejected.

Reference

Snowflake documents the reluctant suffix, its non-greedy semantics, and the supported quantifier forms in the MATCH_RECOGNIZE pattern syntax.

Tests

  • cargo +1.95.0 test --offline --all-features match_recognize (2 passed)
  • cargo +1.95.0 test --offline --all-features
  • cargo +1.95.0 fmt --all -- --check
  • Upstream stable, beta, nightly, no-std, lint, docs, codestyle, benchmark-lint, RAT, and license checks pass

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.

1 participant