lalitx17 commented on PR #37890:
URL: https://github.com/apache/beam/pull/37890#issuecomment-4107179611

   For REPEATED fields (which are List values in Java), the matcher first 
checks that both values have the same class (e.g. ArrayList), then calls 
expectedVal.equals(actualVal). The List.equals() method in java compares 
element by element in order.
   (can be found towards the end of rowMatch())
   ```
    if (!expectedVal.getClass().equals(actualVal.getClass())) {
     return false;
   }
   
   if (!expectedVal.equals(actualVal)) {
     return false;
   }
   ```
   Also I've already included the list order related tests.
   
   ```
     @Test
     public void testIdenticalListFields() {
       TableRow row1 = new TableRow().set("tags", Arrays.asList("a", "b"));
       TableRow row2 = new TableRow().set("tags", Arrays.asList("a", "b"));
       assertThat(row1, isTableRowEqualTo(row2));
     }
   
     @Test
     public void testListFieldsWithDifferentOrder() {
       TableRow row1 = new TableRow().set("tags", Arrays.asList("a", "b"));
       TableRow row2 = new TableRow().set("tags", Arrays.asList("b", "a"));
       assertThat(row1, not(isTableRowEqualTo(row2)));
     }
   ```
   
   Happy to rename these to testRepeatedField_identicalOrder_areEqual() and 
testRepeatedField_differentOrder_areNotEqual() to make the BigQuery REPEATED 
field context more explicit.


-- 
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]

Reply via email to