Skip to content

Incorrect user-supplied Avro schema (--avroSchemaFilePath) causes dbeam to produce invalid avro files. #579

Description

@rulle-io

When an Avro user-supplied Avro schema doesn't correspond to actual columns returned by SQL SELECT statement, dbeam produces avro data files, which cause exceptions be thrown when users try to read them.

Identified use-cases

1. Avro schema has less fields than SQL SELECT columns

 * SQL SELECT has columns: COF_NAME, plus many others ...
 * Avro schema has fields: COF_NAME (fewer than expected).
 * This scenario produces an Avro file, which seems to OK,
 * but an exception is thrown when one tries to read it.
 * org.apache.avro.AvroRuntimeException: Malformed data. Length is negative: -50

2. Avro schema has other order of fields than SQL SELECT columns

 * SQL SELECT has columns: COF_NAME, SIZE, TOTAL
 * Avro schema has fields: TOTAL, COF_NAME, SIZE (another order).
 * This scenario produces an Avro file, which seems to OK,
 * but an exception is thrown when one tries to read it.
 * java.lang.ArrayIndexOutOfBoundsException: Index -50 out of bounds for length 2

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions