Search in sources :

Example 1 with StructWithUnionV1

use of org.apache.parquet.thrift.test.compat.StructWithUnionV1 in project parquet-mr by apache.

the class TestThriftRecordConverter method constructorDoesNotRequireStructOrUnionTypeMeta.

@Test
public void constructorDoesNotRequireStructOrUnionTypeMeta() throws Exception {
    String jsonWithNoStructOrUnionMeta = Strings.join(Files.readAllLines(new File("src/test/resources/org/apache/parquet/thrift/StructWithUnionV1NoStructOrUnionMeta.json"), Charset.forName("UTF-8")), "\n");
    StructType noStructOrUnionMeta = (StructType) ThriftType.fromJSON(jsonWithNoStructOrUnionMeta);
    // this used to throw, see PARQUET-346
    new ThriftRecordConverter<StructWithUnionV1>(new ThriftReader<StructWithUnionV1>() {

        @Override
        public StructWithUnionV1 readOneRecord(TProtocol protocol) throws TException {
            return null;
        }
    }, "name", new ThriftSchemaConverter().convert(StructWithUnionV1.class), noStructOrUnionMeta);
}
Also used : StructWithUnionV1(org.apache.parquet.thrift.test.compat.StructWithUnionV1) TException(org.apache.thrift.TException) StructType(org.apache.parquet.thrift.struct.ThriftType.StructType) TProtocol(org.apache.thrift.protocol.TProtocol) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 StructType (org.apache.parquet.thrift.struct.ThriftType.StructType)1 StructWithUnionV1 (org.apache.parquet.thrift.test.compat.StructWithUnionV1)1 TException (org.apache.thrift.TException)1 TProtocol (org.apache.thrift.protocol.TProtocol)1 Test (org.junit.Test)1