Snowflake: decode octal/hex/unicode string-literal escapes - #16
Closed
wojpadlo wants to merge 1 commit into
Closed
Conversation
Decode \ooo, \xhh and \uhhhh as Unicode code points, keep \0 as NUL, collapse unrecognized letters (\a, \Z) to the bare letter, and raise a tokenizer error on malformed \x / \u — gated behind a new supports_snowflake_string_literal_escapes dialect capability so other backslash-escaping dialects keep MySQL/BigQuery semantics. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
Superseded by #17, which rebases the same escape-parity commit directly onto |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Decodes Snowflake single-quoted string-literal escapes in the tokenizer:
\ooo(octal),\xhh(hex) and\uhhhh(unicode) → the corresponding code point\0stays NUL\a,\Z, …) collapse to the bare letter\x/\uraise a tokenizer errorGated behind a new
supports_snowflake_string_literal_escapesdialect capability so other backslash-escaping dialects keep their MySQL/BigQuery semantics.Files:
src/tokenizer.rs(+192/-5),src/dialect/mod.rs,src/dialect/snowflake.rs,tests/sqlparser_common.rs.Why
This is the parser-fork side of LAV-1329 ("string-literal escape parity"). It is a prerequisite for LAV-1330 (multi-character
FIELD_DELIMITER/RECORD_DELIMITERon the CSV load path): that task requires a hex-escaped delimiter value such asFIELD_DELIMITER = '\x7C\x7C'to decode to||. The currently pinned fork rev (b5e11f27) maps unknown escapes to the bare char (\x7C→x7C), so the emulator never sees||. Real Snowflake decodes it.Stacking
Stacked on top of #14 (
lav-1362-masking-policy), matching the existing PR chain (#15 → #14 → …). Diff against this base is the single escape-parity commit. Once this and its ancestors land inmain, the downstreamsnowflake-rsCargo.tomlsqlparserpin must be bumped to consume it before LAV-1330 can proceed.🤖 Generated with Claude Code