maosuhan commented on code in PR #24035:
URL: https://github.com/apache/flink/pull/24035#discussion_r1499433950


##########
docs/content/docs/connectors/table/formats/protobuf.md:
##########
@@ -149,9 +149,12 @@ Format Options
       <td style="word-wrap: break-word;">false</td>
       <td>Boolean</td>
       <td>
-          This option only works if the generated class's version is proto2. 
If this value is set to true, the format will read empty values as the default 
values defined in the proto file.

Review Comment:
   Is this a breaking change? 
   If users set read-default-values=false with high version of proto3, after 
this change, the row content after deserialization will be different if they 
also use one-of field.



##########
flink-formats/flink-protobuf/src/test/java/org/apache/flink/formats/protobuf/Pb3ToRowTest.java:
##########
@@ -92,34 +93,19 @@ public void testReadDefaultValues() throws Exception {
         Pb3Test pb3Test = Pb3Test.newBuilder().build();
         RowData row = ProtobufTestHelper.pbBytesToRow(Pb3Test.class, 
pb3Test.toByteArray());
 
+        // primitive types should have default values
         assertFalse(row.isNullAt(0));
         assertFalse(row.isNullAt(1));
         assertFalse(row.isNullAt(2));
         assertFalse(row.isNullAt(3));
         assertFalse(row.isNullAt(4));
         assertFalse(row.isNullAt(5));
-        assertFalse(row.isNullAt(6));
-        assertFalse(row.isNullAt(7));
         assertFalse(row.isNullAt(8));
-        assertFalse(row.isNullAt(9));
-        assertFalse(row.isNullAt(10));
 
-        assertEquals(0, row.getInt(0));
-        assertEquals(0L, row.getLong(1));
-        assertEquals("", row.getString(2).toString());
-        assertEquals(Float.valueOf(0.0f), Float.valueOf(row.getFloat(3)));
-        assertEquals(Double.valueOf(0.0d), Double.valueOf(row.getDouble(4)));
-        assertEquals("UNIVERSAL", row.getString(5).toString());

Review Comment:
   @sharath1709 I think the validation for primitive types is still meaningful?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to