Repository navigation
fix(cli): map BIGNUMERIC, JSON and INTERVAL BigQuery fields to their own primitives - #2446
Conversation
…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.
|
/gcbrun |
| }); | ||
| }); | ||
|
|
||
| test("table() keeps BIGNUMERIC, JSON and INTERVAL field types", async () => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| ]); | ||
| }); | ||
|
|
||
| test("executeRaw() keeps BIGNUMERIC, JSON and INTERVAL field types", async () => { |
There was a problem hiding this comment.
Removed, see above.
Both table() and executeRaw() convert fields through convertField(), so one assertion covers the mapping; no-duplicate-case guards the switch.
|
/gcbrun |
|
/gcbrun |
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.
Split out of #2433 at @Ford544's request.
Problem
convertFieldType()incli/api/dbadapters/bigquery.tshas duplicatecaselabels.BIGNUMERICis listed withNUMERIC, andJSON/INTERVALwithSTRING, before their own cases further down. The first match wins, soBIGNUMERICis reported asNUMERIC,JSONandINTERVALasSTRING, and the dedicated cases for theField.PrimitivevaluesBIGNUMERIC = 13,JSON = 14andINTERVAL = 15can never run.Changes
no-duplicate-case. These labels were its only hits in the repo.Behavior
This changes the field types reported by
table(),tables(),search()andexecuteRaw(), including the schemas JiT code receives (GetTable,ListTables,ExecuteResponse.schemaFields). Code that reads these will now seeBIGNUMERIC,JSONandINTERVALinstead ofNUMERIC/STRING. No built-in execution logic branches on these primitives.Tests
cli/api/dbadapters/bigquery_test.tsextends the existingtables() with schema filters correctlytest withBIGNUMERIC,NUMERIC,JSONandINTERVALcolumns, and checks each field'sprimitiveas well as its name.table(),tables(),search()andexecuteRaw()all convert fields through the sameconvertField(), so one test covers the mapping. It fails onmain(BIGNUMERIC,JSONandINTERVALcome back as5,4,4instead of13,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