diff --git a/parquet-protobuf/src/test/java/org/apache/parquet/proto/ProtoWriteSupportTest.java b/parquet-protobuf/src/test/java/org/apache/parquet/proto/ProtoWriteSupportTest.java index 360da8b741..309828488a 100644 --- a/parquet-protobuf/src/test/java/org/apache/parquet/proto/ProtoWriteSupportTest.java +++ b/parquet-protobuf/src/test/java/org/apache/parquet/proto/ProtoWriteSupportTest.java @@ -1343,7 +1343,7 @@ public void testProto3WrappedMessageUnwrappedRoundTrip() throws Exception { msg.setWrappedInt64(Int64Value.of(1_000_000_000L * 4)); msg.setWrappedUInt64(UInt64Value.of(1_000_000_000L * 9)); msg.setWrappedInt32(Int32Value.of(1_000_000 * 3)); - msg.setWrappedUInt32(UInt32Value.of(1_000_000 * 8)); + msg.setWrappedUInt32(UInt32Value.of(Integer.MIN_VALUE)); msg.setWrappedBool(BoolValue.of(true)); msg.setWrappedString(StringValue.of("Good Will Hunting")); msg.setWrappedBytes(BytesValue.of(ByteString.copyFrom("someText", "UTF-8"))); @@ -1364,7 +1364,7 @@ public void testProto3WrappedMessageUnwrappedRoundTrip() throws Exception { assertEquals(1_000_000_000L * 4, gotBackFirst.getWrappedInt64().getValue()); assertEquals(1_000_000_000L * 9, gotBackFirst.getWrappedUInt64().getValue()); assertEquals(1_000_000 * 3, gotBackFirst.getWrappedInt32().getValue()); - assertEquals(1_000_000 * 8, gotBackFirst.getWrappedUInt32().getValue()); + assertEquals(Integer.MIN_VALUE, gotBackFirst.getWrappedUInt32().getValue()); assertEquals(BoolValue.of(true), gotBackFirst.getWrappedBool()); assertEquals("Good Will Hunting", gotBackFirst.getWrappedString().getValue()); assertEquals( @@ -1372,6 +1372,26 @@ public void testProto3WrappedMessageUnwrappedRoundTrip() throws Exception { gotBackFirst.getWrappedBytes().getValue()); } + @Test + public void testProto3WrappedMessageUnwrappedRoundTripUint32() throws Exception { + TestProto3.WrappedMessage msgMin = TestProto3.WrappedMessage.newBuilder().setWrappedUInt32(UInt32Value.of(Integer.MAX_VALUE)).build(); + TestProto3.WrappedMessage msgMax = TestProto3.WrappedMessage.newBuilder().setWrappedUInt32(UInt32Value.of(Integer.MIN_VALUE)).build(); + + Path tmpFilePath = TestUtils.someTemporaryFilePath(); + ParquetWriter writer = ProtoParquetWriter.builder(tmpFilePath) + .withMessage(TestProto3.WrappedMessage.class) + .config(ProtoWriteSupport.PB_UNWRAP_PROTO_WRAPPERS, "true") + .build(); + writer.write(msgMin); + writer.write(msgMax); + writer.close(); + List gotBack = TestUtils.readMessages(tmpFilePath, TestProto3.WrappedMessage.class); + + assertEquals(msgMin, gotBack.get(0)); + assertEquals(msgMax, gotBack.get(1)); + + } + @Test public void testProto3WrappedMessageWithNullsRoundTrip() throws Exception { TestProto3.WrappedMessage.Builder msg = TestProto3.WrappedMessage.newBuilder();