[ 
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 (kafka2.out) with the attached avro 
schema (generic_wrapper.avsc), 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

 

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), however 
only seem to get the first element of the array.

 

Is the schema incorrect?

  was:
Trying to decode the attached binary file (kafka2.out) with the attached avro 
schema (generic_wrapper.avsc), 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

 

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).

 

Is the schema incorrect?


> 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 (kafka2.out) with the attached avro 
> schema (generic_wrapper.avsc), 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
>  
> 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), 
> however only seem to get the first element of the array.
>  
> Is the schema incorrect?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to