validation: route ingest readback through an IngestSelectRoundTripQuery quirk - #10
Open
fornwall wants to merge 1 commit into
Open
validation: route ingest readback through an IngestSelectRoundTripQuery quirk#10fornwall wants to merge 1 commit into
fornwall wants to merge 1 commit into
Conversation
…ry quirk The TestSqlIngest* templates read ingested rows back with a hardcoded `SELECT * FROM "bulk_ingest" ORDER BY ...`. That is unportable for a GoogleSQL/Spanner-style driver: double-quoted identifiers aren't valid GoogleSQL, and a driver that adds a synthetic primary-key column on create-mode ingest leaks that column through `SELECT *`, breaking the single-column readback assertions. Add a backward-compatible `DriverQuirks::IngestSelectRoundTripQuery` hook that projects the ingested columns explicitly. Its default reproduces the exact historical `SELECT * FROM "table" ORDER BY <body>` string, so existing drivers see identical SQL; a driver can override it to project only the named columns with its own identifier quoting. Route the five ORDER BY readback sites through the hook. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JtLEb7yAhv2qAZFoSbzKjp
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.
The
TestSqlIngest*templates read ingested rows back with a hardcodedSELECT * FROM "bulk_ingest" ORDER BY .... That string is unportable fordrivers with a different SQL dialect, in two ways:
GoogleSQL (Spanner needs backticks), so the readback query fails to parse.
synthetic primary-key column (Spanner requires a PK) has that extra column
leak through
SELECT *, breaking the templates' single-column schema andvalue assertions.
This adds a backward-compatible
DriverQuirks::IngestSelectRoundTripQueryhook that projects only the ingested columns the test asserts on, letting a
driver override both the projection and the identifier quoting (e.g. emit
SELECT <columns> FROM `bulk_ingest` ORDER BY <col>). The defaultreproduces the exact historical
SELECT * FROM "table" ORDER BY <body>string, so existing drivers see identical SQL and behavior is unchanged.
The five ORDER BY readback sites (the numeric/temporal/interval type
templates,
TestSqlIngestMultipleConnections, andTestSqlIngestSample)are routed through the hook, passing the asserted column name(s) and the
existing ORDER BY body verbatim. Together this un-blocks the
SqlIngest*family for drivers that (a) quote identifiers differently and (b) add a
synthetic primary-key column on create-mode ingest.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JtLEb7yAhv2qAZFoSbzKjp