rahil-c commented on code in PR #17916:
URL: https://github.com/apache/hudi/pull/17916#discussion_r2699345226


##########
hudi-hadoop-common/src/main/java/org/apache/hudi/io/lance/HoodieBaseLanceWriter.java:
##########
@@ -194,27 +212,18 @@ public void close() throws IOException {
    * Flush buffered records to Lance file.
    */
   private void flushBatch() throws IOException {
-    if (bufferedRecords.isEmpty()) {
-      return;
+    if (currentBatchSize == 0) {
+      return;  // Nothing to flush
     }
 
-    // Lazy initialization of writer and root
-    if (writer == null) {
-      initializeWriter();
-    }
-    if (root == null) {
-      root = VectorSchemaRoot.create(getArrowSchema(), allocator);
-    }
+    // Finalize the arrow writer (sets row count on VectorSchemaRoot)
+    arrowWriter.finish();

Review Comment:
   nit: instead of `finish()` should the interface method be renamed to 
something more clear like `setRowCount()` or is there other functionality 
outside of setting rowCount as well that `finish()` handles? 



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