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/05/09 03:10:15 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #5516: HUDI-4044 When reading data from flink-hudi to external storage, the …

danny0405 commented on code in PR #5516:
URL: https://github.com/apache/hudi/pull/5516#discussion_r867601249


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java:
##########
@@ -181,7 +182,8 @@ public DataStream<RowData> produceDataStream(StreamExecutionEnvironment execEnv)
           OneInputStreamOperatorFactory<MergeOnReadInputSplit, RowData> factory = StreamReadOperator.factory((MergeOnReadInputFormat) inputFormat);
           SingleOutputStreamOperator<RowData> source = execEnv.addSource(monitoringFunction, getSourceOperatorName("split_monitor"))
               .setParallelism(1)
-              .transform("split_reader", typeInfo, factory)
+                  .keyBy((KeySelector<MergeOnReadInputSplit, String>) mos -> String.valueOf(mos.getFileId()))
+                  .transform("split_reader", typeInfo, factory)

Review Comment:
   Is the explicit cast necessary ?



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/mor/MergeOnReadInputSplit.java:
##########
@@ -67,6 +67,34 @@ public MergeOnReadInputSplit(
     this.instantRange = Option.ofNullable(instantRange);
   }
 
+  public MergeOnReadInputSplit(
+          int splitNum,
+          @Nullable String basePath,
+          Option<List<String>> logPaths,
+          String latestCommit,
+          String tablePath,
+          long maxCompactionMemoryInBytes,
+          String mergeType,
+          @Nullable InstantRange instantRange,String fileId ) {

Review Comment:
   Why we must add a new constructor ?



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java:
##########
@@ -316,7 +318,7 @@ private List<MergeOnReadInputSplit> buildFileIndex() {
                   .map(logFile -> logFile.getPath().toString())
                   .collect(Collectors.toList()));
               return new MergeOnReadInputSplit(cnt.getAndAdd(1), basePath, logPaths, latestCommit,
-                  metaClient.getBasePath(), maxCompactionMemoryInBytes, mergeType, null);
+                  metaClient.getBasePath(), maxCompactionMemoryInBytes, mergeType, null,fileSlice.getFileId());
             }).collect(Collectors.toList()))

Review Comment:
   `null,fileSlice.getFileId()` -> `null, fileSlice.getFileId()`



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/IncrementalInputSplits.java:
##########
@@ -226,7 +226,7 @@ public Result inputSplits(
               String basePath = fileSlice.getBaseFile().map(BaseFile::getPath).orElse(null);
               return new MergeOnReadInputSplit(cnt.getAndAdd(1),
                   basePath, logPaths, endInstant,
-                  metaClient.getBasePath(), maxCompactionMemoryInBytes, mergeType, instantRange);
+                  metaClient.getBasePath(), maxCompactionMemoryInBytes, mergeType, instantRange,fileSlice.getFileId());
             }).collect(Collectors.toList()))

Review Comment:
   `instantRange,fileSlice.getFileId()` -> `instantRange, fileSlice.getFileId()`



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