leilinee commented on issue #597: HoodieDeltaSteamer cannot deserialize avro 
source correctly
URL: https://github.com/apache/incubator-hudi/issues/597#issuecomment-472908792
 
 
   thanks for your answer.
   
   I have solved this problem. The  HoodieDeltaSteamer consume avro data from 
topic and then create spark RDDs , in this process,  HoodieDeltaSteamer 
deserialize avro data by **KafkaAvroDecoder.**
   
   ```
   protected JavaRDD<GenericRecord> toAvroRDD(OffsetRange[] offsetRanges, 
AvroConvertor avroConvertor) {
     JavaRDD<GenericRecord> recordRDD = KafkaUtils
         .createRDD(sparkContext, String.class, Object.class, 
StringDecoder.class, KafkaAvroDecoder.class, kafkaParams, offsetRanges)
         .values()
         .map(obj -> (GenericRecord) obj);
     return recordRDD;
   }
   ```
   
   I rewrited **KafkaAvroDecoder** with my deserialize avro data code .
   
   It have to implement  **Decoder** class and declare a construction method.
   
   my deserialize code is in `this.deserialize()`.
   
   ```
   public class KafkaAvroDecoder  implements Decoder<Object>   {
       public KafkaAvroDecoder(VerifiableProperties props) {
           props = null;
       }
   
       public Object fromBytes(byte[] bytes) {
             return this.deserialize(bytes);
       }
   }
   ```
   It seems my program works well. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to