Repository navigation
fix(bigquery)!: keep raw and adjacent pieces of bytes, typed literals and grantees - #264
Merged
Merged
Conversation
… and grantees BigQuery gave one tree for literals written different ways: b'ab', b'a' b'b' and rb'ab'; DATE, DATETIME, TIME and TIMESTAMP of a plain, a raw or an adjacent string; JSON, NUMERIC and the other self-typed casts of a raw or adjacent string; and a GRANT grantee as a plain, raw or adjacent string. The shared tree gains two literal kinds, raw bytes and adjacent bytes, each keeping what was written. A typed literal of a raw or adjacent string is a self-typed cast of that literal, and a grantee written raw or in pieces records the written literal beside its name. The GROUP BY match that already treats r'ab' as 'ab' now also reads raw and adjacent bytes as one bytes literal and a raw or adjacent date or time typed literal as the plain one, so these spellings give no new E230. Bytes of the new kinds type as BYTES. BREAKING CHANGE: sqlquack-syntax adds Literal::RawByteString and Literal::JoinedBytes, and GrantPrincipal gains a written field, so an exhaustive match on Literal or a GrantPrincipal struct literal no longer compiles.
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.
Why
BigQuery gave one tree for literals written different ways, so formatting, fingerprints and lint could not tell them apart:
b'ab',b'a' b'b'andrb'ab';DATE,DATETIME,TIMEandTIMESTAMPof a plain, a raw or an adjacent string;JSON,NUMERICand other self-typed literals of a raw or adjacent string;GRANTgrantee written plain, raw or as adjacent strings.Changes
LiteralgainsRawByteString(rb'...') andJoinedBytes(adjacent bytes: joined value and pieces as written).GrantPrincipalgains an optionalwritten: Option<Literal>, set only for a BigQuery grantee written raw or in pieces. Code that matchesLiteralexhaustively or buildsGrantPrincipalby its fields must handle them.r'ab'as'ab', also reads raw and adjacent bytes as one bytes literal and a raw or adjacent date or time typed literal as the plain one, so these spellings give no new E230. The new bytes kinds type asBYTESand the binary family.Verification
make check-cipassed on the identical tree in fix(bigquery)!: keep raw and adjacent pieces of bytes, typed literals and grantees #263, which this replaces only to mark the commit itself breaking.rb'\u{ff}'andb'\xc3\xbf'to differ in the tree.DATE, adjacentDATETIME, rawTIMESTAMPand rawNUMERICmatch their plain forms; raw bytes of another value still give E230;rb'\u{ff}'matchesb'\xc3\xbf'.