danny0405 commented on code in PR #6134:
URL: https://github.com/apache/hudi/pull/6134#discussion_r963372089
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/flip27/split/HoodieFileRecords.java:
##########
@@ -0,0 +1,77 @@
+package org.apache.hudi.source.flip27.split;
+
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.metrics.groups.SourceReaderMetricGroup;
+import org.apache.flink.table.data.RowData;
+
+import javax.annotation.Nullable;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ *
+ */
+public class HoodieFileRecords implements RecordsWithSplitIds<RowData> {
+
+ @Nullable
+ private String splitId;
+ private Iterator<RowData> iterator;
+ private final Set<String> finishedSplits;
+
+ private SourceReaderMetricGroup sourceReaderMetricGroup;
+
+ public HoodieFileRecords(@Nullable String splitId,SourceReaderMetricGroup
sourceReaderMetricGroup, Iterator<RowData> iterator, Set<String>
finishedSplits) {
+ this.splitId = splitId;
+ this.iterator = iterator;
+ this.sourceReaderMetricGroup = sourceReaderMetricGroup;
+ this.finishedSplits = finishedSplits;
+ }
+
+ public static HoodieFileRecords empty(Set<String> finishedSplits) {
+ return new HoodieFileRecords(null, null,null, finishedSplits);
+ }
+
+ @Nullable
+ @Override
+ public String nextSplit() {
+ final String nextSplit = this.splitId;
+ this.splitId = null;
+ return nextSplit;
+ }
+
+ @Nullable
+ @Override
+ public RowData nextRecordFromSplit() {
+ try {
+ if (iterator != null && iterator.hasNext()) {
+ return iterator.next();
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException();
+ }
+ return null;
+ }
Review Comment:
Should we return null here ?
--
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]