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

Storage API Avro encoding does not work with nullable fields #252

Open
ianb-pomelo opened this issue Dec 6, 2023 · 0 comments
Open

Storage API Avro encoding does not work with nullable fields #252

ianb-pomelo opened this issue Dec 6, 2023 · 0 comments

Comments

@ianb-pomelo
Copy link

I've created a table with nullable columns but when I use the Storage API to stream read the table, if there are rows that don't have data in all column, the avro encoding fails with value does not match its schema: long: expected: Go numeric; received: <nil>

Example:
Create Table

StandardTableDefinition.of(
  Schema.of(
    Field.newBuilder(ENCOUNTER_ID_COLUMN, INT64).setMode(NULLABLE).build(),
    Field.newBuilder(PATIENT_ID_COLUMN, INT64).setMode(NULLABLE).build(),
    Field.newBuilder(APPOINTMENT_ID_COLUMN, INT64)
      .setMode(NULLABLE)
      .setDefaultValueExpression("NULL")
      .build(),
    Field.newBuilder(ENCOUNTER_DATE_COLUMN, DATE).setMode(NULLABLE).build()
  )
)

Insert Row:

RowToInsert.of(
  mapOf(
    ENCOUNTER_ID_COLUMN to 1234,
    PATIENT_ID_COLUMN to 1234,
    APPOINTMENT_ID_COLUMN to null,
    ENCOUNTER_DATE_COLUMN to null
  )
)

Throws: io.grpc.StatusRuntimeException: UNKNOWN: failed to encode binary from go value: cannot encode binary record "testproject.athena_dataviewer.encounters" field "APPOINTMENTID": value does not match its schema: long: expected: Go numeric; received: <nil>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants