hudi-agent commented on code in PR #19692:
URL: https://github.com/apache/hudi/pull/19692#discussion_r3831767924


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/buffer/RowDataBucket.java:
##########
@@ -61,13 +63,24 @@ public void sort() throws IOException {
   }
 
   public boolean writeRow(RowData rowData) throws IOException {
+    ValidationUtils.checkState(
+        !diverged,
+        "RowData bucket " + bucketId + " diverged after a failed write and 
cannot be reused");
     boolean success = dataBuffer.write(rowData);
     if (success) {
       detector.detect(rowData);
+    } else {
+      // BinaryInMemorySortBuffer may have partially appended variable-length 
data before
+      // returning false. Its internal pointers can no longer be trusted for 
another write.
+      diverged = true;
     }
     return success;
   }
 
+  public boolean isDiverged() {

Review Comment:
   🤖 nit: this class already uses Lombok `@Getter` for other fields (e.g. 
`bucketId`) — you could annotate the `diverged` field with `@Getter` (it 
generates `isDiverged()` for booleans) instead of hand-writing the accessor.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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