Skip to content

Fix(snowflake)!: refactor colon (extract) parsing precedence - #7046

Merged
georgesittas merged 1 commit into
mainfrom
jo/fix_edge_case_sf_colon
Feb 11, 2026
Merged

Fix(snowflake)!: refactor colon (extract) parsing precedence#7046
georgesittas merged 1 commit into
mainfrom
jo/fix_edge_case_sf_colon

Conversation

@georgesittas

Copy link
Copy Markdown
Collaborator

We used to have mutual recursion between _parse_column_ops and _parse_colon_as_variant_extract, which resulted in a couple of issues:

  1. The added test failed because there's a stack frame where the start-end token range represents the text 'level1 : level2: level3'. This resulted in a JSONPathKey that included the redundant whitespace following level1.
  2. The recursion would lead to a complexity class of O(n²), involving various costly steps like parsing JSON paths and various function calls. This becomes an issue for queries with deeply nested JSON constructs where : is used to access the corresponding fields.

@github-actions

Copy link
Copy Markdown
Contributor

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:jo/fix_edge_case_sf_colon, sqlglot version: jo/fix_edge_case_sf_colon)
  • baseline (main, sqlglot version: 28.10.1.dev68)

⚠️ Limited to dialects: snowflake

By Dialect

dialect main sqlglot:jo/fix_edge_case_sf_colon transitions links
snowflake -> duckdb 1529/2403 passed (63.6%) 1531/2403 passed (63.7%) 2 fail->pass full result / delta
snowflake -> snowflake 2616/2623 passed (99.7%) 2616/2623 passed (99.7%) No change full result / delta

Overall

main: 5026 total, 4145 passed (pass rate: 82.5%), sqlglot version: 28.10.1.dev68

sqlglot:jo/fix_edge_case_sf_colon: 5026 total, 4147 passed (pass rate: 82.5%), sqlglot version: jo/fix_edge_case_sf_colon

Transitions: 2 fail->pass

@georgesittas
georgesittas merged commit f9d1f73 into main Feb 11, 2026
9 checks passed
@georgesittas
georgesittas deleted the jo/fix_edge_case_sf_colon branch February 11, 2026 12:10
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