Skip to content

fix(cubejs): BigQuery read-only rollups typed from the result schema - #90

Merged
acmeguy merged 2 commits into
mainfrom
fix/bigquery-readonly-schema-types
Oct 7, 2026
Merged

acmeguy merged 2 commits into
mainfrom
fix/bigquery-readonly-schema-types

Conversation

@acmeguy

@acmeguy acmeguy commented Oct 7, 2026

Copy link
Copy Markdown

Why

The first read-only attempt (#88, reverted in #89) regressed abler-web-prod. In read-only mode, Cube 1.7.30's BigQuery driver falls back to the base downloadQueryResults, which guesses column types from the rows:

  • A decimal arriving after whole numbers fails the Cube Store load (Can't parse int).
  • An empty partition can't be typed at all ("Unable to detect column types … readOnly mode").

Neither Cube 1.7.50 nor 1.8.1 changes this, so upgrading would not help.

What

  1. Postinstall patch: BigQueryDriver.downloadQueryResults. It runs the query job, then reads the column types from BigQuery's result schema (getQueryResults({maxResults: 0, autoPaginate: false})), mapped exactly as tableColumnTypes maps them for the staging path. A drift guard refuses to apply it to changed Cube source.
  2. Re-enables readOnly: true for BigQuery datasources (reverts Revert BigQuery read-only rollups (regressed abler-web-prod) #89).

Tests

Unit (cube17Regression):

  • Read-only types must equal tableColumnTypes for the same schema, with whole numbers first, so row guessing would get them wrong.
  • An empty partition gets types instead of an error.
  • Both failed before the patch, the empty case with the exact production error.

Real data, in-cluster (84 Abler partitions taken from the failed read-only run, with Synmetrix's own datasource loader and the patched driver):

  • All 69 partitions that failed in read-only now download and load into Cube Store: 57 empty QA partitions and 12 prod Can't parse int partitions.
  • 27 prod partitions are identical to their staging-built Cube Store tables, comparing row counts and every numeric column sum. That's the 12 above plus 15 older daily, monthly and yearly partitions.
  • The scratch Cube Store schema was dropped afterwards.

Full suite, locally: only the 2 known stale-local-install dependency-hardening failures. The image build runs the full suite from the lockfile.

Rollout

Same as #88: once latest is built, delete the cubejs pods (API one at a time, then the worker); Argo selfHeal is on.

The datasource hash changes again, so Cube cleans up stale table versions. Watch the partition count per schema, not the table count. Rollback is a revert PR.

🤖 Generated with Claude Code

acmeguy and others added 2 commits October 7, 2026 17:44
In read-only mode Cube 1.7.30's BigQuery driver falls back to the base
downloadQueryResults, which guesses column types from the rows. A decimal
after whole numbers then fails the Cube Store load ("Can't parse int"),
and an empty partition cannot be typed at all. This is why read-only
regressed abler-web-prod on 2026-10-07 and was reverted (#89).

A postinstall patch gives the driver its own downloadQueryResults: run
the query job, then read the column types from BigQuery's result schema
(getQueryResults with maxResults 0), mapped exactly as tableColumnTypes
maps them for the staging path. Neither 1.7.50 nor 1.8.1 fixes this
upstream.

Tested on 84 real Abler partitions in-cluster: all 69 that failed in
read-only now build, and 27 prod partitions are identical (row count and
every numeric sum) to their staging-built Cube Store tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 7792062, now that read-only downloads take their
column types from BigQuery's result schema. Rollups load straight into
Cube Store; nothing is written to the customer's BigQuery project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acmeguy
acmeguy merged commit 08314c8 into main Oct 7, 2026
3 checks passed
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