Repository navigation
fix: Snowflake SQL tests read expected columns through __ref() and table function calls - #1736
Merged
Merged
Conversation
…ble function calls
On Snowflake, an expected CTE that read another relation through
__ref() failed compile with S000: its body was parsed as authored, and
the Snowflake parser can't read a bare __ref("x") table call.
Expected columns are now read with each relation marker as a plain
name, and on Snowflake each __table_fn call in TABLE( ), as rule trees
are. Error positions map back to the authored body. A body whose
columns can't be read is P028, naming the test, the CTE and either the
parser's reason and position or why its columns aren't named.
Snowflake parse errors now carry byte offsets, as ParserGap documents,
so a parse error after multibyte text is placed at the right column;
this also corrects P026.
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
On Snowflake, an
__expected__<model>CTE that reads another relation through__ref()(in a join, aWHEREsubquery, or a__table_fncall) failed compile with an internalS000error. The expected body was parsed as authored, and the Snowflake parser can't read a bare__ref("x")table call.Changes
__table_fncall wrapped inTABLE( ), the same way rule trees are parsed. Error positions map back to the authored body.P028, instead ofS000: it names the test and CTE, and either the line, column and parser reason, or why the columns aren't named (a repeated name, an unnamed expression,SELECT *, no columns).P026reports.__ref()now compare columns by name, as documented, instead of by position.__ref(), with expectations derived by hand.Verification
--run-on local): join,WHEREsubquery and mocked-model join pass; a wrong value fails with exit 1; an unparseable body fails withP028. All five fail withS000on main.SELECTwith no columns.P028; all other goldens unchanged.sqb compile --no-cache, same machine, 3 alternating runs, medians without the new case: base 2.02 s wall / 5.73 s CPU, head 2.03 s / 5.80 s; phase timings and diagnostics unchanged. With it, base stops withS000and head compiles clean.make check-cipass.