You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/10/30 04:22:41 UTC

[GitHub] [flink] JingsongLi commented on a change in pull request #13847: [FLINK-19799][connector files] FileSource supports extensions with subclasses of FileSourceSplit

JingsongLi commented on a change in pull request #13847:
URL: https://github.com/apache/flink/pull/13847#discussion_r514822513



##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/reader/BulkFormat.java
##########
@@ -92,30 +91,22 @@
  * handed over as one.
  */
 @PublicEvolving
-public interface BulkFormat<T> extends Serializable, ResultTypeQueryable<T> {
+public interface BulkFormat<T, SplitT extends FileSourceSplit> extends Serializable, ResultTypeQueryable<T> {
 
 	/**
-	 * Creates a new reader that reads from {@code filePath} starting at {@code offset} and reads
-	 * until {@code length} bytes after the offset.
+	 * Creates a new reader that reads from the {@link FileSourceSplit#path() split's path}
+	 * starting at the {@link FileSourceSplit#offset()} split's offset} and reads
+	 * {@link FileSourceSplit#length() length} bytes after the offset.
 	 */
-	BulkFormat.Reader<T> createReader(
-			Configuration config,
-			Path filePath,
-			long splitOffset,
-			long splitLength) throws IOException;
+	BulkFormat.Reader<T> createReader(Configuration config, SplitT split) throws IOException;

Review comment:
       Looks like we can merge `createReader` and `restoreReader`, Format can be judged by `FileSourceSplit.getReaderPosition` like `FileSourceSplitReader.checkSplitOrStartNext`.
   
   I don't have a strong tendency: A separate `restore` looks clearer. But may bring some `assert` like `StreamFormatAdapter` do.




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

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