JingGe commented on a change in pull request #17501:
URL: https://github.com/apache/flink/pull/17501#discussion_r770011202



##########
File path: 
flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/reader/StreamFormat.java
##########
@@ -157,6 +166,88 @@
             long splitEnd)
             throws IOException;
 
+    /**
+     * Creates a new reader to read in this format. This method is called when 
a fresh reader is
+     * created for a split that was assigned from the enumerator. This method 
may also be called on
+     * recovery from a checkpoint, if the reader never stored an offset in the 
checkpoint (see
+     * {@link #restoreReader(Configuration, Path, long, long, long)} for 
details.
+     *
+     * <p>Provide the default implementation, subclasses are therefore not 
forced to implement it.
+     * Compare to the {@link #createReader(Configuration, FSDataInputStream, 
long, long)}, This
+     * method put the focus on the {@link Path}. The default implementation 
adapts information given
+     * by method arguments to {@link FSDataInputStream} and calls {@link
+     * #createReader(Configuration, FSDataInputStream, long, long)}.
+     *
+     * <p>If the format is {@link #isSplittable() splittable}, then the {@code 
inputStream} is
+     * positioned to the beginning of the file split, otherwise it will be at 
position zero.
+     */
+    default StreamFormat.Reader<T> createReader(
+            Configuration config, Path filePath, long splitOffset, long 
splitLength)
+            throws IOException {

Review comment:
       For example `FileRecordFormatAdapter` or any other new `FormatAdapter` 
that wants to work with Flink Path.




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


Reply via email to