[
https://issues.apache.org/jira/browse/AVRO-2232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eugen Iancu updated AVRO-2232:
------------------------------
Description:
Trying to decode the attached binary file with the attached avro schema, in a
very generic approach in Scala:
def decode(message: Array[Byte], schemaString: String): GenericRecord = {
val schema: Schema = new Schema.Parser().parse(schemaString) val reader:
DatumReader[GenericRecord] = new SpecificDatumReader[GenericRecord](schema) val
decoder: Decoder = DecoderFactory.get().binaryDecoder(message, null)
reader.read(null, decoder)
}
Resulting Generic Record:
Decoded data: {"table_name": "APP_HDP_TEST.TESTNUM", "schema_fingerprint":
1679940236203361734, "payload": {"bytes": "(APP_HDP_TEST.TESTNUMI42018-09-27
13:27:57.16162142018-09-28T08:45:01.038000(00000000130000338537ID
Attached binary file and schema are provided by Oracle GoldenGate and we expect
to see information for both TESTNUM and TESTID tables in the decoded message
(as in the attached screenshot from vim of the binary file).
was:
Trying to decode the attached binary file with the attached avro schema, in a
very generic approach in Scala:
def decode(message: Array[Byte], schemaString: String): GenericRecord = {
val schema: Schema = new Schema.Parser().parse(schemaString)
val reader: DatumReader[GenericRecord] = new
SpecificDatumReader[GenericRecord](schema)
val decoder: Decoder = DecoderFactory.get().binaryDecoder(message, null)
reader.read(null, decoder)
}
Resulting Generic Record:
Decoded data: {"table_name": "APP_HDP_TEST.TESTNUM", "schema_fingerprint":
1679940236203361734, "payload": {"bytes": "(APP_HDP_TEST.TESTNUMI42018-09-27
13:27:57.16162142018-09-28T08:45:01.038000(00000000130000338537ID
Attached binary file and schema are provided by Oracle GoldenGate and we expect
to see information for both TESTNUM and TESTID tables in the decoded message
(as in the attached screenshot from vim of the binary file).
> Incorrect Decoding
> ------------------
>
> Key: AVRO-2232
> URL: https://issues.apache.org/jira/browse/AVRO-2232
> Project: Avro
> Issue Type: Bug
> Affects Versions: 1.8.2
> Reporter: Eugen Iancu
> Priority: Major
> Attachments: avro_vim.JPG, generic_wrapper.avsc, kafka2.out
>
>
> Trying to decode the attached binary file with the attached avro schema, in a
> very generic approach in Scala:
> def decode(message: Array[Byte], schemaString: String): GenericRecord = {
> val schema: Schema = new Schema.Parser().parse(schemaString) val reader:
> DatumReader[GenericRecord] = new SpecificDatumReader[GenericRecord](schema)
> val decoder: Decoder = DecoderFactory.get().binaryDecoder(message, null)
> reader.read(null, decoder)
> }
>
> Resulting Generic Record:
> Decoded data: {"table_name": "APP_HDP_TEST.TESTNUM", "schema_fingerprint":
> 1679940236203361734, "payload": {"bytes": "(APP_HDP_TEST.TESTNUMI42018-09-27
> 13:27:57.16162142018-09-28T08:45:01.038000(00000000130000338537ID
>
> Attached binary file and schema are provided by Oracle GoldenGate and we
> expect to see information for both TESTNUM and TESTID tables in the decoded
> message (as in the attached screenshot from vim of the binary file).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)