You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/07/18 12:46:10 UTC

[GitHub] [hudi] JerryYue-M opened a new pull request, #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

JerryYue-M opened a new pull request, #6134:
URL: https://github.com/apache/hudi/pull/6134

   ## *Tips*
   - *Thank you very much for contributing to Apache Hudi.*
   - *Please review https://hudi.apache.org/contribute/how-to-contribute before opening a pull request.*
   
   ## What is the purpose of the pull request
   
   *(For example: This pull request adds quick-start document.)*
   
   ## Brief change log
   
   *(for example:)*
     - *Modify AnnotationLocation checkstyle rule in checkstyle.xml*
   
   ## Verify this pull request
   
   *(Please pick either of the following options)*
   
   This pull request is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   *(example:)*
   
     - *Added integration tests for end-to-end.*
     - *Added HoodieClientWriteTest to verify the change.*
     - *Manually verified the change by running a job locally.*
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
   


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


[GitHub] [hudi] Leoyzen commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
Leoyzen commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1375557203

   what's the status of this pr right now?


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


[GitHub] [hudi] danny0405 commented on a diff in pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

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

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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1187369367

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1187357638

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c 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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1235189995

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=11106",
       "triggerID" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9aa239791e1433b4861641d93666ac3efddae90f Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=11106) 
   
   <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


[GitHub] [hudi] danny0405 commented on a diff in pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
danny0405 commented on code in PR #6134:
URL: https://github.com/apache/hudi/pull/6134#discussion_r963368406


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/flip27/split/HoodieFileSourceSplitReader.java:
##########
@@ -0,0 +1,113 @@
+package org.apache.hudi.source.flip27.split;
+
+import org.apache.hudi.table.format.mor.MergeOnReadInputFormat;
+import org.apache.hudi.table.format.mor.MergeOnReadInputSplit;
+
+import org.apache.flink.api.connector.source.SourceReaderContext;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.source.reader.RecordsWithSplitIds;
+import org.apache.flink.connector.base.source.reader.splitreader.SplitReader;
+import org.apache.flink.connector.base.source.reader.splitreader.SplitsAddition;
+import org.apache.flink.connector.base.source.reader.splitreader.SplitsChange;
+import org.apache.flink.metrics.groups.SourceReaderMetricGroup;
+import org.apache.flink.table.data.RowData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.LinkedBlockingDeque;
+
+/**
+ * hoodie file source spilt reader.
+ */
+public class HoodieFileSourceSplitReader implements SplitReader<RowData, MergeOnReadInputSplit> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(HoodieFileSourceSplitReader.class);
+
+  private final Configuration config;
+
+  private final Queue<MergeOnReadInputSplit> splits = new LinkedBlockingDeque<>();
+
+  private MergeOnReadInputFormat currentFormat;
+  private MergeOnReadInputFormat format;
+
+  private final SourceReaderContext context;
+
+  @Nullable
+  private String currentSplitId;
+  private SourceReaderMetricGroup sourceReaderMetricGroup;
+  private int subTaskId;
+
+  public HoodieFileSourceSplitReader(Configuration config, SourceReaderContext context, MergeOnReadInputFormat format) {
+    this.context = context;
+    this.format = format;
+    this.config = config;
+    this.subTaskId = context.getIndexOfSubtask();
+    this.sourceReaderMetricGroup = context.metricGroup();
+  }
+
+  @Override
+  public RecordsWithSplitIds<RowData> fetch() throws IOException {
+    moveToNextSplit();
+    Iterator<RowData> nextBatch = currentFormat.readBatch();
+    if (nextBatch == null) {
+      currentFormat = null;
+    }
+    return nextBatch != null ? HoodieFileRecords.forRecords(this.currentSplitId,this.sourceReaderMetricGroup, nextBatch) : finishSplit();
+  }
+
+  @Override
+  public void handleSplitsChanges(SplitsChange<MergeOnReadInputSplit> splitsChange) {
+    if (!(splitsChange instanceof SplitsAddition)) {
+      throw new UnsupportedOperationException(
+        String.format(
+          "The SplitChange type of %s is not supported.",
+          splitsChange.getClass()));
+    }
+
+    LOG.info("Handling split change {}", splitsChange);
+    splits.addAll(splitsChange.splits());
+  }
+
+  @Override
+  public void wakeUp() {
+
+  }
+
+  public void moveToNextSplit() throws IOException {
+    if (currentFormat != null || splits.isEmpty()) {
+      return;
+    }
+    this.currentFormat = format.copy();
+    MergeOnReadInputSplit split = splits.poll();
+    if (split != null) {
+      this.currentSplitId = split.splitId();

Review Comment:
   Should we throw exception if the next `split` is null ?



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


[GitHub] [hudi] JerryYue-M commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
JerryYue-M commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1376800563

   > what's the status of this pr right now?
   This is OnGoing
   this will rebase with the master and add some ut tests later


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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1187836838

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1235055657

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=11106",
       "triggerID" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035) 
   * 9aa239791e1433b4861641d93666ac3efddae90f Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=11106) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #6134: WIP:refactor hoodie stream source based flip-27 and support watermark

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #6134:
URL: https://github.com/apache/hudi/pull/6134#issuecomment-1235053579

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035",
       "triggerID" : "fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9aa239791e1433b4861641d93666ac3efddae90f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fae2cd0cdd24fd03bb8ec71dbbc8f06114fa4e7c Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=10035) 
   * 9aa239791e1433b4861641d93666ac3efddae90f 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