You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "HuangZhenQiu (via GitHub)" <gi...@apache.org> on 2026/01/14 07:46:38 UTC

[PR] feat: support mini batch split reader [hudi]

HuangZhenQiu opened a new pull request, #17872:
URL: https://github.com/apache/hudi/pull/17872

   ### Describe the issue this Pull Request addresses
   Support batch read with configuration for Flink source split reader
   
   ### Summary and Changelog
    
   Add classes to support batch read from ClosableIterator returned by file group reader
   
   ### Impact
   
    none
   
   ### Risk Level
   
   
   ### Documentation Update
   
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] Adequate tests were added if applicable
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748274125

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 01fd07f4e4f388e343f9a9c8b3577878ced2ae4a Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034) 
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748469428

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 01fd07f4e4f388e343f9a9c8b3577878ced2ae4a Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034) 
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "xushiyan (via GitHub)" <gi...@apache.org>.
xushiyan merged PR #17872:
URL: https://github.com/apache/hudi/pull/17872


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "HuangZhenQiu (via GitHub)" <gi...@apache.org>.
HuangZhenQiu commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2699624715


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/HoodieSourceSplitReader.java:
##########
@@ -67,15 +70,27 @@ public HoodieSourceSplitReader(
 
   @Override
   public RecordsWithSplitIds<HoodieRecordWithPosition<T>> fetch() throws IOException {
-    HoodieSourceSplit nextSplit = splits.poll();
-    if (nextSplit != null) {
-      currentSplit = nextSplit;
-      currentSplitId = nextSplit.splitId();
-      return readerFunction.read(currentSplit);
+    if (currentReader == null) {
+      HoodieSourceSplit nextSplit = splits.poll();
+      if (nextSplit != null) {
+        currentSplit = nextSplit;
+        currentSplitId = nextSplit.splitId();
+        currentReader = readerFunction.read(currentSplit);

Review Comment:
   RecordsWithSplitIds can only read from one split. You can see line 86, if currentReader is created for a split, it will be used to read from all of the data from particular split. 
   
   For failover recover, the split record offset will be only updated during record emit  https://github.com/apache/hudi/blob/master/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/HoodieRecordEmitter.java#L34. Only hoodie source splits will be checkpointed. From recover from failure, the record offset in hoodie source split will be used to move iterator of HoodieFileGroupReader to the right record offset.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3761351011

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     }, {
       "hash" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144",
       "triggerID" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   * 388bef02f10ecad1f7d262b62632f9c961706f77 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "cshuo (via GitHub)" <gi...@apache.org>.
cshuo commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2696582008


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/DefaultBatchReader.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.source.reader;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.source.split.HoodieSourceSplit;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.util.CloseableIterator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Default batch reader implementation.
+ *
+ * @param <T> record type
+ */
+public class DefaultBatchReader<T> implements BatchReader<T> {
+
+  private final int batchSize;
+
+  public DefaultBatchReader(Configuration configuration) {
+    this.batchSize = configuration.get(FlinkOptions.SOURCE_READER_FETCH_BATCH_RECORD_COUNT);

Review Comment:
   add validation for `batchSize`.



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/DefaultBatchReader.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.source.reader;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.source.split.HoodieSourceSplit;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.util.CloseableIterator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Default batch reader implementation.
+ *
+ * @param <T> record type
+ */
+public class DefaultBatchReader<T> implements BatchReader<T> {
+
+  private final int batchSize;
+
+  public DefaultBatchReader(Configuration configuration) {
+    this.batchSize = configuration.get(FlinkOptions.SOURCE_READER_FETCH_BATCH_RECORD_COUNT);
+  }
+
+  @Override
+  public CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> batch(
+      HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+    return new ListBatchIterator(split, inputIterator);
+  }
+
+  private class ListBatchIterator implements CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> {
+    private final ClosableIterator<T> inputIterator;
+    private final HoodieSourceSplit split;
+
+    ListBatchIterator(HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+      this.inputIterator = inputIterator;
+      this.split = split;
+      seek();
+    }
+
+    @Override
+    public boolean hasNext() {
+      return inputIterator.hasNext();
+    }
+
+    @Override
+    public RecordsWithSplitIds<HoodieRecordWithPosition<T>> next() {
+      if (!inputIterator.hasNext()) {

Review Comment:
   The `hasNext()` method is not idempotent; the underlying file group reader advances to read the next record inside `hasNext()`. Seems we should add an iterator wrapper which has an idempotent `hasNext()` method.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3761341027

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     }, {
       "hash" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   * 388bef02f10ecad1f7d262b62632f9c961706f77 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748266693

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 01fd07f4e4f388e343f9a9c8b3577878ced2ae4a Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748259322

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 01fd07f4e4f388e343f9a9c8b3577878ced2ae4a UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "cshuo (via GitHub)" <gi...@apache.org>.
cshuo commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2702975903


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/DefaultHoodieBatchReader.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.source.reader;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.source.split.HoodieSourceSplit;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.util.CloseableIterator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Default batch reader implementation.
+ *
+ * @param <T> record type
+ */
+public class DefaultBatchReader<T> implements BatchReader<T> {
+
+  private final int batchSize;
+
+  public DefaultBatchReader(Configuration configuration) {
+    this.batchSize = configuration.get(FlinkOptions.SOURCE_READER_FETCH_BATCH_RECORD_COUNT);
+  }
+
+  @Override
+  public CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> batch(
+      HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+    return new ListBatchIterator(split, inputIterator);
+  }
+
+  private class ListBatchIterator implements CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> {
+    private final ClosableIterator<T> inputIterator;
+    private final HoodieSourceSplit split;
+
+    ListBatchIterator(HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+      this.inputIterator = inputIterator;
+      this.split = split;
+      seek();
+    }
+
+    @Override
+    public boolean hasNext() {
+      return inputIterator.hasNext();
+    }
+
+    @Override
+    public RecordsWithSplitIds<HoodieRecordWithPosition<T>> next() {
+      if (!inputIterator.hasNext()) {

Review Comment:
   ignore this comment, the `hasNext` method of file group reader and internal `recordBuffer` is implemented as idempotent.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3761529831

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     }, {
       "hash" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144",
       "triggerID" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   * 388bef02f10ecad1f7d262b62632f9c961706f77 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144) 
   * b389cfeed8e7f4fc3cafd9702b5ac8c958718f82 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "HuangZhenQiu (via GitHub)" <gi...@apache.org>.
HuangZhenQiu commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2699614061


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/DefaultHoodieBatchReader.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.source.reader;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.source.split.HoodieSourceSplit;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.util.CloseableIterator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Default batch reader implementation.
+ *
+ * @param <T> record type
+ */
+public class DefaultBatchReader<T> implements BatchReader<T> {
+
+  private final int batchSize;
+
+  public DefaultBatchReader(Configuration configuration) {
+    this.batchSize = configuration.get(FlinkOptions.SOURCE_READER_FETCH_BATCH_RECORD_COUNT);
+  }
+
+  @Override
+  public CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> batch(
+      HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+    return new ListBatchIterator(split, inputIterator);
+  }
+
+  private class ListBatchIterator implements CloseableIterator<RecordsWithSplitIds<HoodieRecordWithPosition<T>>> {
+    private final ClosableIterator<T> inputIterator;
+    private final HoodieSourceSplit split;
+
+    ListBatchIterator(HoodieSourceSplit split, ClosableIterator<T> inputIterator) {
+      this.inputIterator = inputIterator;
+      this.split = split;
+      seek();
+    }
+
+    @Override
+    public boolean hasNext() {
+      return inputIterator.hasNext();
+    }
+
+    @Override
+    public RecordsWithSplitIds<HoodieRecordWithPosition<T>> next() {
+      if (!inputIterator.hasNext()) {

Review Comment:
   I don't see file group reader advances to read the next record inside hasNext(). Would you please give me more context?
   
   https://github.com/apache/hudi/blob/master/hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieFileGroupReader.java#L243



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "HuangZhenQiu (via GitHub)" <gi...@apache.org>.
HuangZhenQiu commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2699599871


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/DefaultHoodieBatchReader.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.source.reader;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.source.split.HoodieSourceSplit;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.util.CloseableIterator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Default batch reader implementation.
+ *
+ * @param <T> record type
+ */
+public class DefaultBatchReader<T> implements BatchReader<T> {
+
+  private final int batchSize;
+
+  public DefaultBatchReader(Configuration configuration) {
+    this.batchSize = configuration.get(FlinkOptions.SOURCE_READER_FETCH_BATCH_RECORD_COUNT);

Review Comment:
   Good catch.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3761559403

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     }, {
       "hash" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144",
       "triggerID" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11150",
       "triggerID" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 388bef02f10ecad1f7d262b62632f9c961706f77 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144) 
   * b389cfeed8e7f4fc3cafd9702b5ac8c958718f82 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11150) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748787125

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #17872:
URL: https://github.com/apache/hudi/pull/17872#discussion_r2693204242


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/reader/HoodieSourceSplitReader.java:
##########
@@ -67,15 +70,27 @@ public HoodieSourceSplitReader(
 
   @Override
   public RecordsWithSplitIds<HoodieRecordWithPosition<T>> fetch() throws IOException {
-    HoodieSourceSplit nextSplit = splits.poll();
-    if (nextSplit != null) {
-      currentSplit = nextSplit;
-      currentSplitId = nextSplit.splitId();
-      return readerFunction.read(currentSplit);
+    if (currentReader == null) {
+      HoodieSourceSplit nextSplit = splits.poll();
+      if (nextSplit != null) {
+        currentSplit = nextSplit;
+        currentSplitId = nextSplit.splitId();
+        currentReader = readerFunction.read(currentSplit);

Review Comment:
   is the `#fetch` executes in series with the reader task checkpoint? Is the `RecordsWithSplitIds` stored within the flink state? looks like the `RecordsWithSplitIds` can already represents a set of records from multiple splits.
   
   Is the records in `currentReader` can be recovered for a task failover?



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3748592175

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 01fd07f4e4f388e343f9a9c8b3577878ced2ae4a Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034) 
   * 9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support mini batch split reader [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #17872:
URL: https://github.com/apache/hudi/pull/17872#issuecomment-3761962828

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11034",
       "triggerID" : "01fd07f4e4f388e343f9a9c8b3577878ced2ae4a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11037",
       "triggerID" : "9b3a9b06709bb8eb58d0beb72c347ffcb3b8aeff",
       "triggerType" : "PUSH"
     }, {
       "hash" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11144",
       "triggerID" : "388bef02f10ecad1f7d262b62632f9c961706f77",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11150",
       "triggerID" : "b389cfeed8e7f4fc3cafd9702b5ac8c958718f82",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b389cfeed8e7f4fc3cafd9702b5ac8c958718f82 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=11150) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org