Skip to content

OneOf fields skipped as "synthetic" but still marshalled by the Marshaller #368

@ubunatic

Description

@ubunatic

We have upgraded from v0.25.0 to a higher version lately and see issues with newly created tables.
We use options.InferSchema(msg) to create and update schemas for our tables.
We use options.Marshal(msg) to marshal the messages.

With version v.26.0+, some rows cannot be ingested and BQ rejects them with an error:

some.field._some_one_of: no such field: _some_one_of."; Reason: "invalid"

We use these Options:

protobq.SchemaOptions{
	UseEnumNumbers:           false,
	UseOneofFields:           true,
	UseDateTimeWithoutOffset: true,
}

When calling options.Marshal(msg), the nested map[string]bigquery.Value will contain the _some_one_of field.
When calling options.InferSchema(msg) the nested bigquery.Schema will not contain the _some_one_of field anymore.

When I disable this change:

  // if oneof.IsSynthetic() {
  // 	continue
  // }

everything works as expected.

How do you handle this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions