ClassCastException while using ThriftData for serializing Thrift data in Avro format

Viewed 303

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!

1 Answers

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

Related