zjureel commented on code in PR #418:
URL: https://github.com/apache/flink-table-store/pull/418#discussion_r1038979729


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/utils/RecordReaderUtils.java:
##########
@@ -44,4 +45,49 @@ public static <T> void forEachRemaining(
             reader.close();
         }
     }
+
+    /**
+     * Returns a {@link RecordReader} that applies {@code function} to each 
element of {@code
+     * fromReader}.
+     */
+    public static <L, R> RecordReader<R> transform(
+            RecordReader<L> fromReader, Function<L, R> function) {
+        return new RecordReader<R>() {
+            @Override
+            public RecordIterator<R> readBatch() throws IOException {
+                RecordIterator<L> iterator = fromReader.readBatch();
+                if (iterator == null) {
+                    return null;
+                }
+                return transform(iterator, function);
+            }
+
+            @Override
+            public void close() throws IOException {
+                fromReader.close();
+            }
+        };
+    }
+
+    /**
+     * Returns an iterator that applies {@code function} to each element of 
{@code fromIterator}.
+     */
+    public static <L, R> RecordReader.RecordIterator<R> transform(
+            RecordReader.RecordIterator<L> fromIterator, Function<L, R> 
function) {
+        return new RecordReader.RecordIterator<R>() {
+            @Override
+            public R next() throws IOException {

Review Comment:
   Add @Nullable



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to