hutiefang76 commented on PR #12578:
URL: https://github.com/apache/seatunnel/pull/12578#issuecomment-5987879851

   Thanks @SEZ9.
   
   > if you can paste the relevant assertions here, that will speed it up
   
   These are the existing assertions in 
`testSetFieldInvalidatesCachedBytesSize` at unchanged head `ec14f3a` 
([source](https://github.com/apache/seatunnel/blob/ec14f3a3a421e3a6027121e4ae3cd3482c39e312/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java#L253-L277)):
   
   ```java
   SeaTunnelRow typed = new SeaTunnelRow(new Object[] {"abc"});
   Assertions.assertEquals(3, typed.getBytesSize(rowType));
   typed.setField(0, "abcdef");
   Assertions.assertEquals(6, typed.getBytesSize());
   Assertions.assertEquals(6, typed.getBytesSize(rowType));
   
   SeaTunnelRow untyped = new SeaTunnelRow(new Object[] {"abc"});
   Assertions.assertEquals(3, untyped.getBytesSize());
   untyped.setField(0, "abcdef");
   Assertions.assertEquals(6, untyped.getBytesSize(rowType));
   Assertions.assertEquals(6, untyped.getBytesSize());
   ```
   
   > If an existing test already does this, just point me to its name.
   
   Both limitation cases already exist at that same head. 
`testDirectFieldMutationDoesNotInvalidateCachedBytesSize` 
([source](https://github.com/apache/seatunnel/blob/ec14f3a3a421e3a6027121e4ae3cd3482c39e312/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java#L280-L294))
 measures the row first and explicitly observes the stale cache after a direct 
array write:
   
   ```java
   Assertions.assertEquals(3, row.getBytesSize(rowType));
   row.getFields()[0] = "abcdef";
   Assertions.assertEquals("abcdef", row.getField(0));
   Assertions.assertEquals(3, row.getBytesSize());
   Assertions.assertEquals(3, row.getBytesSize(rowType));
   row.setField(0, row.getField(0));
   Assertions.assertEquals(6, row.getBytesSize());
   ```
   
   `testNestedFieldMutationDoesNotInvalidateParentCachedBytesSize` 
([source](https://github.com/apache/seatunnel/blob/ec14f3a3a421e3a6027121e4ae3cd3482c39e312/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java#L297-L316))
 calls the child setter without calling the parent setter, and keeps the parent 
estimate stale until `parent.setField`:
   
   ```java
   Assertions.assertEquals(3, child.getBytesSize(childType));
   Assertions.assertEquals(3, parent.getBytesSize(parentType));
   child.setField(0, "abcdef");
   Assertions.assertEquals(6, child.getBytesSize());
   Assertions.assertEquals(3, parent.getBytesSize());
   Assertions.assertEquals(3, parent.getBytesSize(parentType));
   parent.setField(0, child);
   Assertions.assertEquals(6, parent.getBytesSize(parentType));
   ```
   
   These cover F4/shared-cache F5 and F3/the mutation-limit half of F5 
respectively. No code has changed since the head you are rechecking.


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