Skip to content

Switch the SQL backend to googlesqlite and harden BigQuery compatibility#448

Merged
goccy merged 1 commit into
mainfrom
googlesqlite
May 18, 2026
Merged

Switch the SQL backend to googlesqlite and harden BigQuery compatibility#448
goccy merged 1 commit into
mainfrom
googlesqlite

Conversation

@goccy

@goccy goccy commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the SQL backend with the googlesqlite driver (pinned to v0.1.0)
and raises the emulator's BigQuery compatibility across the board, with a new
multi-client conformance test suite to guard it.

Conformance testing

  • New test/e2e suite runs the official Python, Ruby, PHP, Node.js and
    Java
    client libraries, plus the bq CLI, against a locally started
    emulator over a shared query corpus (test/e2e/cases/cases.json).
  • Orchestrated with testcontainers; runs in a dedicated integration
    GitHub Actions workflow.

Query & result correctness

  • TIMESTAMP results encoded as numeric epoch values, not datetime strings.
  • Explicit NULLABLE mode emitted on query result fields.
  • maxResults paging honored in jobs.getQueryResults.
  • Query jobs expose their anonymous results table (destinationTable).
  • NUMERIC / BIGNUMERIC mapped to Arrow decimal types; Arrow upgraded to
    arrow-go/v18.
  • Empty or absent numeric, temporal and string query parameters treated as
    typed NULLs.

DDL, load & streaming

  • Views dropped with DROP VIEW; view schemas hydrated; DDL-created and
    materialized views registered in metadata.
  • Unknown fields reported in tabledata.insertAll.
  • WRITE_TRUNCATE / WRITE_EMPTY load dispositions honored.
  • Schema inferred for autodetect CSV loads.

Performance & robustness

  • Dataset child lookups batched so per-request metadata cost stays constant.
  • Pooled connection released when BeginTx fails.

Testing

  • go test ./... unit suite: green.
  • test/e2e conformance suite: green for all six clients.

🤖 Generated with Claude Code

Replace the SQL backend with the googlesqlite driver (pinned to v0.1.0)
and raise the emulator's BigQuery compatibility across the board.

Conformance testing:
- Add a multi-client conformance suite (test/e2e) that runs the official
  Python, Ruby, PHP, Node.js and Java client libraries plus the bq CLI
  against a locally started emulator over a shared query corpus, driven
  by testcontainers from a dedicated integration GitHub Actions workflow.

Query and result correctness:
- Encode TIMESTAMP results as numeric epoch values, not datetime strings.
- Emit an explicit NULLABLE mode on query result fields.
- Honor maxResults paging in jobs.getQueryResults.
- Expose the anonymous results table on query jobs (destinationTable).
- Map NUMERIC/BIGNUMERIC to Arrow decimal types; migrate to arrow-go/v18.
- Treat empty or absent numeric, temporal and string query parameters
  as typed NULLs.

DDL, load and streaming:
- Drop views with DROP VIEW, hydrate view schemas, and register both
  DDL-created and materialized views.
- Report unknown fields in tabledata.insertAll.
- Honor WRITE_TRUNCATE / WRITE_EMPTY load dispositions.
- Infer the schema for autodetect CSV loads.

Performance and robustness:
- Batch dataset child lookups so per-request metadata cost stays constant.
- Release the pooled connection when BeginTx fails.
- Build without cgo (the SQL backend is pure Go); the build no longer needs clang or mold, and go.mod targets Go 1.25.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@goccy goccy merged commit cc2e431 into main May 18, 2026
5 checks passed
@goccy goccy deleted the googlesqlite branch May 18, 2026 03:39
goccy added a commit that referenced this pull request May 18, 2026
The SQL backend is now pure Go and the build no longer links native
code (see #448), so the mold linker is no longer needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
goccy added a commit that referenced this pull request May 18, 2026
…461)

* Refresh README for the googlesqlite backend and add a feature matrix

Reflect the switch to the googlesqlite SQL backend and document, in one
place, what the emulator actually supports today.

- Add docs/feature-support.md: a MECE (mutually exclusive, collectively
  exhaustive) BigQuery feature support matrix, organized after the
  official BigQuery documentation and REST API reference. It covers the
  full REST surface, job types, table types, ingestion/export formats,
  the GoogleSQL surface, security, BigQuery ML, the Storage API,
  integrations and emulator-specific features.
- Slim the README Status section down to a short overview that links to
  that matrix, instead of scattering partial caveats across the README.
- Add a Sponsorship section adapted from the googlesqlite project,
  rewritten from the bigquery-emulator project's perspective, and split
  the former "Goals and Sponsors" heading into "Goals" and "Sponsorship".
- Rename the "Google Standard SQL" section to "GoogleSQL" (its current
  name) and update the function coverage to googlesqlite v0.1.0's
  spec-driven support matrix instead of the stale "200+ functions".
- Note the multi-client conformance suite under test/e2e.
- Replace the cgo-only go-sqlite3 reference in the type conversion
  description with the generic SQLite driver wording.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: derive the Go version from go.mod

The build/test and release workflows pinned Go 1.21.5, while go.mod now
declares go 1.25.0. Replace the hardcoded go-version with
go-version-file: go.mod so CI tracks the module's Go version
automatically, matching what the integration workflow already does.
Also bump actions/setup-go to v5 (v2/v4 predate go-version-file).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: drop the mold setup step from the release workflow

The SQL backend is now pure Go and the build no longer links native
code (see #448), so the mold linker is no longer needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: check out the repo before setup-go in the test job

The test job ran setup-go before checkout. That worked while the Go
version was hardcoded, but go-version-file: go.mod needs go.mod to be
present, so checkout must run first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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