Source:
<code>private FieldSchema getSimpleFieldSchema(final String fieldName, Type parquetType) throws FrontendException { final PrimitiveTypeName parquetPrimitiveTypeName = parquetType.asPrimitiveType().getPrimitiveTypeName(); final LogicalTypeAnnotation logicalTypeAnnotation = parquetType.getLogicalTypeAnnotation(); return parquetPrimitiveTypeName.convert( new PrimitiveTypeNameConverter<Schema.FieldSchema, FrontendException>() { @Override public FieldSchema convertFLOAT(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.FLOAT); } @Override public FieldSchema convertDOUBLE(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.DOUBLE); } @Override public FieldSchema convertINT32(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.INTEGER); } @Override public FieldSchema convertINT64(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.LONG); } @Override public FieldSchema convertINT96(PrimitiveTypeName primitiveTypeName) throws FrontendException { LOG.warn("Converting type " + primitiveTypeName + " to bytearray"); return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } @Override public FieldSchema convertFIXED_LEN_BYTE_ARRAY( PrimitiveTypeName primitiveTypeName) throws FrontendException { if (logicalTypeAnnotation instanceof LogicalTypeAnnotation.DecimalLogicalTypeAnnotation) { return new FieldSchema(fieldName, null, DataType.BIGDECIMAL); } else { return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } } @Override public FieldSchema convertBOOLEAN(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.BOOLEAN); } @Override public FieldSchema convertBINARY(PrimitiveTypeName primitiveTypeName) throws FrontendException { <START> if (logicalTypeAnnotation != null && logicalTypeAnnotation instanceof LogicalTypeAnnotation.StringLogicalTypeAnnotation) { <END> return new FieldSchema(fieldName, null, DataType.CHARARRAY); } else { return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } } }); }</code><technical_language>null check is required</technical_language>

Target:
private FieldSchema getSimpleFieldSchema(final String fieldName, Type parquetType) throws FrontendException { final PrimitiveTypeName parquetPrimitiveTypeName = parquetType.asPrimitiveType().getPrimitiveTypeName(); final LogicalTypeAnnotation logicalTypeAnnotation = parquetType.getLogicalTypeAnnotation(); return parquetPrimitiveTypeName.convert( new PrimitiveTypeNameConverter<Schema.FieldSchema, FrontendException>() { @Override public FieldSchema convertFLOAT(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.FLOAT); } @Override public FieldSchema convertDOUBLE(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.DOUBLE); } @Override public FieldSchema convertINT32(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.INTEGER); } @Override public FieldSchema convertINT64(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.LONG); } @Override public FieldSchema convertINT96(PrimitiveTypeName primitiveTypeName) throws FrontendException { LOG.warn("Converting type " + primitiveTypeName + " to bytearray"); return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } @Override public FieldSchema convertFIXED_LEN_BYTE_ARRAY( PrimitiveTypeName primitiveTypeName) throws FrontendException { if (logicalTypeAnnotation instanceof LogicalTypeAnnotation.DecimalLogicalTypeAnnotation) { return new FieldSchema(fieldName, null, DataType.BIGDECIMAL); } else { return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } } @Override public FieldSchema convertBOOLEAN(PrimitiveTypeName primitiveTypeName) throws FrontendException { return new FieldSchema(fieldName, null, DataType.BOOLEAN); } @Override public FieldSchema convertBINARY(PrimitiveTypeName primitiveTypeName) throws FrontendException { if (logicalTypeAnnotation instanceof LogicalTypeAnnotation.StringLogicalTypeAnnotation) { return new FieldSchema(fieldName, null, DataType.CHARARRAY); } else { return new FieldSchema(fieldName, null, DataType.BYTEARRAY); } } }); }