Repository navigation
SNOW-3930192: Recognize any scheme:// in split_statements, not just file:// - #3001
Merged
sfc-gh-fpawlowski merged 1 commit intoAug 18, 2026
Conversation
…ile:// 4.7.2 (SNOW-3772985) added `//` to INLINE_COMMENT_PREFIXES so `//` line comments are recognized alongside `--`. To keep `file://` stage paths working, it guarded both the line-comment and block-comment branches with a literal `"file://"` check. That guard only covered `file://`, so every other URL scheme containing `://` was truncated at the first `//`: 'http://example.com/path' => 'http:' 's3://bucket/key' => 's3:' 'snow://db.schema.stage/path' => 'snow:' Both guards now test whether the current token contains `://` instead of matching one hardcoded scheme. Two details the tests pin down: - The check is scoped to the current token (`col0`), not to the single character before the marker. `file:///path` contains two overlapping `//` pairs, and the second is preceded by `/`, not `:`, so a one-char lookback still truncates it to `file:/` (this breaks the existing test_file_with_slash_star and test_space_before_put). - The `/*` guard needs the same fix, not just the `//` one. Once `//` is fixed for other schemes, that branch becomes reachable and misreads globs like `s3://bucket/*.csv` as a block-comment start. A substring check is used rather than a scheme-shaped regex so that scheme-like tokens that are not valid RFC 3986 schemes (e.g. `my_scheme://bucket/*.csv`) are also left intact. Requiring whitespace before the marker was considered and rejected: it breaks the existing test_remove_comments_end_of_line, since `--` and `//` start a comment with no preceding whitespace per SQL comment semantics. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sfc-gh-fpawlowski
marked this pull request as ready for review
August 12, 2026 12:33
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3001 +/- ##
==========================================
+ Coverage 65.06% 65.09% +0.02%
==========================================
Files 123 123
Lines 17452 17452
Branches 2398 2398
==========================================
+ Hits 11356 11361 +5
+ Misses 5655 5651 -4
+ Partials 441 440 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sfc-gh-turbaszek
approved these changes
Aug 17, 2026
sfc-gh-fpawlowski
deleted the
SNOW-3930192-split-statements-truncates-urls-with-scheme
branch
August 18, 2026 08:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
SNOW-3930192 — follow-up to SNOW-3772985 (SNOW-3772985: Recognize // line comments in split_statements #2944), which shipped in 4.7.2.
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
The bug
4.7.2 (SNOW-3772985, 57faef8) added
//toINLINE_COMMENT_PREFIXESso//line comments are recognized alongside--. To keepfile://stage paths working, it guarded both the line-comment and block-comment branches with a literal"file://"check.That guard only covers
file://, so every other URL scheme containing://is truncated at the first//:On 4.7.2:
The fix
Both guards now test whether the current token contains
://, instead of matching one hardcoded scheme:Three decisions the tests pin down, each verified by running the suite against the alternative:
The check is scoped to the current token (
col0), not to the single character before the marker.file:///pathcontains two overlapping//pairs, and the second is preceded by/, not:. A one-character lookback still truncates it tofile:/— that variant fails the existingtest_file_with_slash_starandtest_space_before_put.The
/*block-comment guard needs the same fix, not just the//one. It carries the identical"file://"-only check. Once//is fixed for other schemes that branch becomes reachable and misreads globs likes3://bucket/*.csvas a block-comment start (yieldingput s3://bucket).test_scheme_url_with_glob_not_treated_as_block_commentcovers exactly this: it is the one test that separates a complete fix from a//-only fix.A substring check rather than a scheme-shaped regex (
^[A-Za-z][A-Za-z0-9+.-]*://). The regex rejects scheme-like tokens that are not valid RFC 3986 schemes, somy_scheme://bucket/*.csvwould still be truncated tomy_scheme:. The substring check leaves it intact and is identical across both guards.Requiring whitespace before the marker was also considered and rejected: it breaks the existing
test_remove_comments_end_of_line(L_SHIPINSTRUCT-- this is a comment), since--and//start a comment with no preceding whitespace per SQL comment semantics.Tests
test/unit/test_split_statement.pygains two parametrized tests (9 cases). Measured behaviour of the suite against each code version://-guard-only half-fixGenuine comments are unaffected —
select 1 -- c,select 1 // c, no-spaceword//comment,x::int//comment, and comments whose text contains a URL (-- see http://a.com) are all still stripped.Existing coverage is left untouched; the test-file diff is purely additive.
🤖 Generated with Claude Code