Skip to content

fix(bigquery): keep a column's and a struct field's OPTIONS - #267

Merged
kvlonge merged 1 commit into
mainfrom
fix/bigquery-column-options
Nov 19, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/bigquery-column-options

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Why

BigQuery read a table column's and a struct field's OPTIONS (...) and then dropped them, so these gave one tree and lost the options' contents:

  • CREATE TABLE d.t (a INT64 OPTIONS(description='ab')), the same with 'cd', and the same with no OPTIONS;
  • ALTER TABLE d.t ADD COLUMN a INT64 OPTIONS(...);
  • a struct field STRUCT<x INT64 OPTIONS(...)>.

Changes

  • A column definition keeps its entries in ColumnDef.options, and a struct field appends them to StructField.options after NOT NULL: the fields other dialects already fill. No public type changes.
  • The other OPTIONS lists the BigQuery parser reads without a field (constraint OPTIONS, UNDROP, SELECT WITH ... OPTIONS) are unchanged opaque gaps that keep their text.

Verification

  • make check-ci on the head.
  • BigQuery parser tree-pair cases: column, added-column and struct-field OPTIONS with different values, and a column with and without OPTIONS, now give distinct trees (each pair collapsed to one tree on main).

A table column's OPTIONS (...) and a struct field's OPTIONS (...) were
read and dropped, so CREATE TABLE d.t (a INT64 OPTIONS(description='ab'))
and the same with 'cd', or with no OPTIONS, gave one tree. ALTER TABLE
... ADD COLUMN had the same loss.

The column keeps its entries in ColumnDef.options and the struct field
appends them to StructField.options after NOT NULL, the fields other
dialects already fill. The other OPTIONS lists the parser reads without
a field (constraint OPTIONS, UNDROP and SELECT WITH ... OPTIONS) are
opaque gaps that keep their text.
@kvlonge
kvlonge enabled auto-merge November 19, 2026 01:25
@kvlonge
kvlonge added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 563407d Nov 19, 2026
9 checks passed
@kvlonge
kvlonge deleted the fix/bigquery-column-options branch November 19, 2026 02:34
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