gortiz commented on code in PR #11753:
URL: https://github.com/apache/pinot/pull/11753#discussion_r1348448509


##########
pinot-plugins/pinot-input-format/pinot-protobuf/src/test/java/org/apache/pinot/plugin/inputformat/protobuf/ProtoBufConfluentSchemaTest.java:
##########
@@ -114,12 +131,20 @@ public void testSamplePinotConsumer()
       Sample.SampleRecord originalValue = recordList.get(i);
       GenericRow decodedValue = result.get(i);
 
-      for (Map.Entry<Descriptors.FieldDescriptor, Object> fieldWithValue : 
originalValue.getAllFields().entrySet()) {
-        
Assert.assertNotNull(decodedValue.getValue(fieldWithValue.getKey().getName()));
-        if (!fieldWithValue.getKey().isRepeated()) {
-          Assert.assertEquals(fieldWithValue.getValue(), 
decodedValue.getValue(fieldWithValue.getKey().getName()));
-        }
-      }
+      Assert.assertEquals(decodedValue.getValue("name"), 
originalValue.getName(), "Unexpected 'name' value");
+      Assert.assertEquals(decodedValue.getValue("id"), originalValue.getId(), 
"Unexpected 'id' value");
+      Assert.assertEquals(decodedValue.getValue("email"), 
originalValue.getEmail(), "Unexpected 'email' value");
+
+      Object[] expectedFriends = originalValue.getFriendsList()
+          .asByteStringList()
+          .stream()
+          .map(ByteString::toStringUtf8)
+          .toArray(Object[]::new);
+      Assert.assertEquals(decodedValue.getValue("friends"), expectedFriends, 
"Unexpected 'friends' value");
+
+      String expectedOptionalField = i % 2 == 0 ? 
originalValue.getOptionalField() : null;
+      Assert.assertEquals(decodedValue.getValue("optionalField"), 
expectedOptionalField,
+          "Unexpected 'optionalField' value");

Review Comment:
   I've also changed this part because previous code was:
   - less explicit
   - didn't test repeated values
   - didn't test optional once I've added. Or better said, it didn't test the 
value of the optional field on messages when it should value null



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to