Skip to content

chore(c/validation): route hardcoded test SQL through the RewriteSql quirk - #28

Open
fornwall wants to merge 1 commit into
mainfrom
validation-rewrite-sql-sites
Open

chore(c/validation): route hardcoded test SQL through the RewriteSql quirk#28
fornwall wants to merge 1 commit into
mainfrom
validation-rewrite-sql-sites

Conversation

@fornwall

Copy link
Copy Markdown
Owner

What

Routes every dialect-sensitive hardcoded SQL string in adbc_validation_statement.cc through the DriverQuirks::RewriteSql(query_id, default_sql) hook added upstream in apache#4496, so driver harnesses can substitute an equivalent query in their own SQL dialect.

Sites covered, each with a stable query id (StatementTest::<TestName>::<slug>):

  • Ingest readbacks (SELECT * FROM bulk_ingest [ORDER BY ... NULLS FIRST/LAST]) in TestSqlIngestType, TestSqlIngestTemporalType, TestSqlIngestInterval, TestSqlIngestStreamZeroArrays, TestSqlIngestAppend, TestSqlIngestReplace, TestSqlIngestCreateAppend, TestSqlIngestMultipleConnections, TestSqlIngestSample. These break on drivers whose create-mode ingest adds a synthetic key column (so SELECT * has the wrong arity) and on engines that reject NULLS FIRST/NULLS LAST.
  • Non-portable DDL (CREATE TABLE ... (x INT) with no primary key) in TestSqlBind, TestSqlQueryEmpty, TestSqlQueryInsertRollback, TestSqlQueryRowsAffectedDelete{,Stream}.
  • INSERT without a column list in TestSqlBind, TestSqlPrepareUpdate, TestSqlPrepareUpdateStream (GoogleSQL requires an explicit column list).
  • Bare parameter select (SELECT ?, ?) in TestSqlPrepareSelectParams (some engines cannot infer undeclared parameter types without context).

The TestSqlIngestType query id carries the ingested Arrow type (ArrowTypeString(field.type)) as a suffix so quirks can rewrite per type — e.g. a dialect that cannot ORDER BY a list-typed column.

No behavior change for drivers that do not override RewriteSql: the default returns default_sql unchanged.

Why fork-internal

Used by adbc-spanner's validation harness (its ARROW_ADBC_TAG pins this commit); it unlocks ~35 previously-excluded validation cases for the Spanner driver. Candidate for upstreaming to apache/arrow-adbc as a follow-up to apache#4496.

🤖 Generated with Claude Code

https://claude.ai/code/session_011hsYQVXuHhnuiBD7XTVo65

… quirk

Several statement tests hardcode SQL that is not portable across SQL
dialects: CREATE TABLE statements with INT/INTEGER/TEXT columns, INSERT
statements without a column list, ORDER BY ... NULLS FIRST/LAST,
TEXT types, etc.

Route each of these through the new DriverQuirks::RewriteSql hook so
driver test harnesses can substitute an equivalent query in their own
dialect.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
@fornwall
fornwall force-pushed the validation-rewrite-sql-sites branch from 62d8b0c to 6590897 Compare July 14, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant