Write pojo's to parquet file using reflection

前端 未结 3 723
感情败类
感情败类 2021-01-03 05:23

HI Looking for APIs to write parquest with Pojos that I have. I was able to generate avro schema using reflection and then create parquet schema using AvroSchemaConverter.

3条回答
  •  日久生厌
    2021-01-03 05:59

    I wasn't able to find an existing solution, so I implemented it myself. Here is the link to the implementation: https://gist.github.com/alexeygrigorev/eab72e40c6051e0163a6693054906d66

    In short, it does the following:

    • uses reflection to get Avro schema from the pojo
    • using the schema and reflection it converts pojos to GenericRecord objects
    • reflection is applied recursively if the pojo contains other pojos or list of pojos

提交回复
热议问题