Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery: adding a column with a list of strings/... leads to an incorrect ALTER TABLE statement #1714

Open
yasinzaehringer-paradime opened this issue May 14, 2024 · 1 comment
Assignees

Comments

@yasinzaehringer-paradime
Copy link
Contributor

yasinzaehringer-paradime commented May 14, 2024

The background is this code:

Basically, the ALTER TABLE statement is missing the array type if the new column is a list - it will create a new column of the base type, i.e.: if you add a column of type list of strings, then peerdb will create a column of type string in BigQuery. This leads to avro errors down the line which look like this:

[...]
failed to sync records:
failed to push to avro stage:
failed to write records to local Avro file:
failed to write records to temporary Avro file:
failed to write records to OCF writer:
failed to write record to OCF:
cannot translate datum to binary:
[...]
cannot encode binary record "<affected table name>" field "<affected column name>":
value does not match its schema:
cannot encode binary union:
no member schema types support datum:
allowed types: [null string]; received: map[string]interface {}

Note: don't be deceived by allowed types: [null string]; received: map[string]interface {} - this is a very misleading error message. The value (and not the type) is important here, which is map[array:[]] and this value is correct: we want to write an empty list. But the avro only accepts nullable strings here since the BigQuery schema is incorrect.

@serprex
Copy link
Member

serprex commented May 18, 2024

@Amogh-Bharadwaj probably something that'd be fixed as part of #1679

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

No branches or pull requests

3 participants