You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ar...@apache.org on 2021/10/06 08:56:44 UTC

[flink] branch release-1.14 updated: [hotfix][FileSource] Internal refactoring to remove duplicated code without API change. Rename method argument names from "reader" to ***Format to improve the code readability.

This is an automated email from the ASF dual-hosted git repository.

arvid pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.14 by this push:
     new 100d34f  [hotfix][FileSource] Internal refactoring to remove duplicated code without API change. Rename method argument names from "reader" to ***Format to improve the code readability.
100d34f is described below

commit 100d34f4650971b61fe3e40f6b270fc60fd83282
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Tue Oct 5 00:59:20 2021 +0200

    [hotfix][FileSource] Internal refactoring to remove duplicated code without API change. Rename method argument names from "reader" to ***Format to improve the code readability.
    
    (cherry picked from commit 3f8e2b6af181ffa1fe80f23f3325440f8d7ca90a)
---
 .../flink/connector/file/src/FileSource.java       | 24 +++++++---------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/FileSource.java b/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/FileSource.java
index ba0e5e8..fb30403 100644
--- a/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/FileSource.java
+++ b/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/FileSource.java
@@ -161,13 +161,8 @@ public final class FileSource<T> extends AbstractFileSource<T, FileSourceSplit>
      * (GZip).
      */
     public static <T> FileSourceBuilder<T> forRecordStreamFormat(
-            final StreamFormat<T> reader, final Path... paths) {
-        checkNotNull(reader, "reader");
-        checkNotNull(paths, "paths");
-        checkArgument(paths.length > 0, "paths must not be empty");
-
-        final BulkFormat<T, FileSourceSplit> bulkFormat = new StreamFormatAdapter<>(reader);
-        return new FileSourceBuilder<>(paths, bulkFormat);
+            final StreamFormat<T> streamFormat, final Path... paths) {
+        return forBulkFileFormat(new StreamFormatAdapter<>(streamFormat), paths);
     }
 
     /**
@@ -177,12 +172,12 @@ public final class FileSource<T> extends AbstractFileSource<T, FileSourceSplit>
      * <p>Examples for bulk readers are compressed and vectorized formats such as ORC or Parquet.
      */
     public static <T> FileSourceBuilder<T> forBulkFileFormat(
-            final BulkFormat<T, FileSourceSplit> reader, final Path... paths) {
-        checkNotNull(reader, "reader");
+            final BulkFormat<T, FileSourceSplit> bulkFormat, final Path... paths) {
+        checkNotNull(bulkFormat, "reader");
         checkNotNull(paths, "paths");
         checkArgument(paths.length > 0, "paths must not be empty");
 
-        return new FileSourceBuilder<>(paths, reader);
+        return new FileSourceBuilder<>(paths, bulkFormat);
     }
 
     /**
@@ -193,13 +188,8 @@ public final class FileSource<T> extends AbstractFileSource<T, FileSourceSplit>
      * requires often more careful parametrization.
      */
     public static <T> FileSourceBuilder<T> forRecordFileFormat(
-            final FileRecordFormat<T> reader, final Path... paths) {
-        checkNotNull(reader, "reader");
-        checkNotNull(paths, "paths");
-        checkArgument(paths.length > 0, "paths must not be empty");
-
-        final BulkFormat<T, FileSourceSplit> bulkFormat = new FileRecordFormatAdapter<>(reader);
-        return new FileSourceBuilder<>(paths, bulkFormat);
+            final FileRecordFormat<T> recordFormat, final Path... paths) {
+        return forBulkFileFormat(new FileRecordFormatAdapter<>(recordFormat), paths);
     }
 
     // ------------------------------------------------------------------------