Skip to content

Commit

Permalink
PARQUET-2420 : ThriftParquetWriter Convert byte to LogicalType int32 …
Browse files Browse the repository at this point in the history
…bitWidth 8 instead of primitive int32 (#1254)
  • Loading branch information
shreyas-dview authored Jan 19, 2024
1 parent c82d5b4 commit d03b49b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public ConvertedField visit(BoolType boolType, State state) {

@Override
public ConvertedField visit(ByteType byteType, State state) {
return visitPrimitiveType(INT32, state);
return visitPrimitiveType(INT32, LogicalTypeAnnotation.intType(8, true), state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ public void testToThriftType() throws Exception {

@Test
public void testLogicalTypeConvertion() throws Exception {
String expected = "message ParquetSchema {\n" + " required int32 test_i16 (INTEGER(16,true)) = 1;" + "}";
String expected = "message ParquetSchema {\n" + " required int32 test_i16 (INTEGER(16,true)) = 1;\n"
+ " required int32 test_i8 (INTEGER(8,true)) = 2;\n"
+ "}\n";
ThriftSchemaConverter schemaConverter = new ThriftSchemaConverter();
final MessageType converted = schemaConverter.convert(TestLogicalType.class);
assertEquals(MessageTypeParser.parseMessageType(expected), converted);
Expand Down
3 changes: 2 additions & 1 deletion parquet-thrift/src/test/thrift/test.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ struct StructWithExtraField {
}

struct TestLogicalType {
1: required i16 test_i16
1: required i16 test_i16,
2: required byte test_i8
}

0 comments on commit d03b49b

Please sign in to comment.