Skip to content

Snowflake: preserve reluctant MATCH_RECOGNIZE quantifiers - #2510

Merged
LucaCappelletti94 merged 1 commit into
apache:mainfrom
Embucket:snowflake-match-recognize-reluctant
Sep 24, 2026
Merged

LucaCappelletti94 merged 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. The Reluctant wrapper also covers +?, ??, and range forms such as {2,4}?; unsupported stacked quantifiers are rejected.

Reference

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

Tests

  • cargo +1.95.0 test --offline --all-features --test sqlparser_common test_match_recognize_patterns (passed after rebase)
  • The focused test and formatting check passed after rebase. The full all-features suite and upstream CI passed before rebase; current CI is running on the rebased commit.

@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.44444% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.98%. Comparing base (6862e71) to head (cd4a3fd).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/parser/mod.rs 68.57% 3 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2510      +/-   ##
==========================================
+ Coverage   80.96%   80.98%   +0.01%     
==========================================
  Files          42       42              
  Lines       33386    33392       +6     
  Branches    33386    33392       +6     
==========================================
+ Hits        27032    27043      +11     
  Misses       2789     2789              
+ Partials     3565     3560       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@osipovartem
osipovartem force-pushed the snowflake-match-recognize-reluctant branch from f144acc to f45b47e Compare September 24, 2026 11:37
@osipovartem
osipovartem force-pushed the snowflake-match-recognize-reluctant branch from f45b47e to cd4a3fd Compare September 24, 2026 15:25
@LucaCappelletti94

LucaCappelletti94 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

LGTM! The missing lines are all error cases that I think is okay to leave be.
cc @alamb @iffyio

@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Sep 24, 2026
Merged via the queue into apache:main with commit 0fd4fa8 Sep 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants