ClassCastException while using ThriftData for serializing Thrift data in Avro format
Asked Answered
W

1

7

We are trying to find a way to serialize Thrift schema into Avro format.

The flow is as follows:

We have a project 'A' which uses Thrift. The output result object is a thrift based object.

We have project 'B' which uses Avro. We would like to read the project 'A' Thrift schema and produce compatible Avro schema for project 'B'.

We have tried using the ThriftData provided in Apache Avro to serialize the Thrift schema

Schema schema = thriftData.getSchema(XYZ.class);

The execution fails with the message

java.lang.RuntimeException: java.lang.ClassCastException: org.apache.thrift.meta_data.FieldValueMetaData cannot be cast to org.apache.thrift.meta_data.StructMetaData

Any help regarding this would be highly appreciated!

Weig answered 10/6, 2019 at 15:27 Comment(2)
A full stacktrace and a minimal example for XYZ would greatly help.Canaliculus
@ArvidHeise the exception seems to occur here. amrutasaraf did you manually modify the Java generated class by Thrift? Maybe you changed the type field? Can you show us the .thrift file?Sinistrorse
D
0

You might want to check valueMetaData property to check if it has a correct type.

Dacoity answered 19/12, 2019 at 23:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.