[GitHub] [flink-table-store] zjureel commented on a diff in pull request #418: [FLINK-30273] Introduce RecordReaderUtils.transform to transform RecordReader

2022-12-04 Thread GitBox


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  void forEachRemaining(
 reader.close();
 }
 }
+
+/**
+ * Returns a {@link RecordReader} that applies {@code function} to each 
element of {@code
+ * fromReader}.
+ */
+public static  RecordReader transform(
+RecordReader fromReader, Function function) {
+return new RecordReader() {
+@Override
+public RecordIterator readBatch() throws IOException {
+RecordIterator 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  RecordReader.RecordIterator transform(
+RecordReader.RecordIterator fromIterator, Function 
function) {
+return new RecordReader.RecordIterator() {
+@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



[GitHub] [flink-table-store] zjureel commented on a diff in pull request #418: [FLINK-30273] Introduce RecordReaderUtils.transform to transform RecordReader

2022-12-04 Thread GitBox


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


##
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/utils/RecordReaderUtils.java:
##
@@ -44,4 +45,49 @@ public static  void forEachRemaining(
 reader.close();
 }
 }
+
+/**
+ * Returns a {@link RecordReader} that applies {@code function} to each 
element of {@code
+ * fromReader}.
+ */
+public static  RecordReader transform(
+RecordReader fromReader, Function function) {
+return new RecordReader() {
+@Override
+public RecordIterator readBatch() 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