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

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

Open
rulle-io opened this issue Feb 6, 2023 · 0 comments · May be fixed by #377

Comments

@rulle-io
Copy link
Contributor

rulle-io commented Feb 6, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant