Skip to content

fix(cli): map BIGNUMERIC, JSON and INTERVAL BigQuery fields to their own primitives - #2446

Merged
apilaskowski merged 3 commits into
dataform-co:mainfrom
dmargol1:fix/convert-field-type-duplicate-cases
Nov 23, 2026
Merged

apilaskowski merged 3 commits into
dataform-co:mainfrom
dmargol1:fix/convert-field-type-duplicate-cases

Conversation

@dmargol1

@dmargol1 dmargol1 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #2433 at @Ford544's request.

Problem

convertFieldType() in cli/api/dbadapters/bigquery.ts has duplicate case labels. BIGNUMERIC is listed with NUMERIC, and JSON/INTERVAL with STRING, before their own cases further down. The first match wins, so BIGNUMERIC is reported as NUMERIC, JSON and INTERVAL as STRING, and the dedicated cases for the Field.Primitive values BIGNUMERIC = 13, JSON = 14 and INTERVAL = 15 can never run.

Changes

  1. Removed the three early labels, so each type maps to its own primitive.
  2. Enabled ESLint's no-duplicate-case. These labels were its only hits in the repo.

Behavior

This changes the field types reported by table(), tables(), search() and executeRaw(), including the schemas JiT code receives (GetTable, ListTables, ExecuteResponse.schemaFields). Code that reads these will now see BIGNUMERIC, JSON and INTERVAL instead of NUMERIC/STRING. No built-in execution logic branches on these primitives.

Tests

cli/api/dbadapters/bigquery_test.ts extends the existing tables() with schema filters correctly test with BIGNUMERIC, NUMERIC, JSON and INTERVAL columns, and checks each field's primitive as well as its name. table(), tables(), search() and executeRaw() all convert fields through the same convertField(), so one test covers the mapping. It fails on main (BIGNUMERIC, JSON and INTERVAL come back as 5, 4, 4 instead of 13, 14, 15) and passes with the change. bazel test //cli/api/... //cli:index_compile_test (14/14) and ESLint across the repo pass.

🤖 Generated with Claude Code

…own primitives

Duplicate case labels in convertFieldType() matched these types early,
reporting BIGNUMERIC as NUMERIC and JSON/INTERVAL as STRING, so their
dedicated cases were unreachable. Removes the duplicates and enables
ESLint's no-duplicate-case.
@dmargol1
dmargol1 requested a review from a team as a code owner November 13, 2026 14:28
@dmargol1
dmargol1 requested review from rafal-hawrylak and removed request for a team November 13, 2026 14:28
@Ford544

Ford544 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

/gcbrun

Comment thread cli/api/dbadapters/bigquery_test.ts Outdated
});
});

test("table() keeps BIGNUMERIC, JSON and INTERVAL field types", async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this test be integrated into some other test?

It does not look good that we have such specific test unless we have good reason to do so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, done in 6a702cc. table() and executeRaw() both convert fields through convertField(), so one check covers the mapping. I removed both new tests and extended the existing tables() with schema filters correctly test instead: its schema now includes BIGNUMERIC, NUMERIC, JSON and INTERVAL columns, and it checks each field's primitive as well as its name. The test fails on main and passes with the fix.

The no-duplicate-case ESLint rule also guards against reintroducing duplicate case labels.

Comment thread cli/api/dbadapters/bigquery_test.ts Outdated
]);
});

test("executeRaw() keeps BIGNUMERIC, JSON and INTERVAL field types", async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, see above.

Both table() and executeRaw() convert fields through convertField(), so
one assertion covers the mapping; no-duplicate-case guards the switch.
@apilaskowski

Copy link
Copy Markdown
Collaborator

/gcbrun

@apilaskowski

Copy link
Copy Markdown
Collaborator

/gcbrun

@apilaskowski
apilaskowski merged commit 7179dfb into dataform-co:main Nov 23, 2026
13 checks passed
apilaskowski pushed a commit that referenced this pull request Nov 23, 2026
Bump DF_VERSION from 3.1.6 to 3.1.7 to publish a new patch release of @dataform/core and @dataform/cli to npm. This release includes operations without hasOutput omitting dataset (#2476), domain project target and graph validation fixes (#2471), multiline rowConditions assertion fixes (#2424), BigQuery primitive field mappings (#2446), Mermaid graph output (#2435) and npm dependency security updates (#2472 and #2473). Publishing 3.1.7 allows projects to pin dataformCoreVersion to 3.1.7 in workflow_settings.yaml and install the updated CLI.
dmargol1 added a commit to dmargol1/dataform that referenced this pull request Nov 24, 2026
dmargol1 added a commit to dmargol1/dataform that referenced this pull request Nov 24, 2026
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.

4 participants