[GitHub] zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor org.apache.flink.runtime.io.network.api.reader…

2018-10-24 Thread GitBox
zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor 
org.apache.flink.runtime.io.network.api.reader…
URL: https://github.com/apache/flink/pull/6911#discussion_r228020917
 
 

 ##
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/IterationReader.java
 ##
 @@ -21,34 +21,21 @@
 import org.apache.flink.runtime.event.TaskEvent;
 import org.apache.flink.runtime.util.event.EventListener;
 
-import java.io.IOException;
-
 /**
- * The basic API for every reader.
+ * Reader for iteration.
  */
-public interface ReaderBase {
-
-   /**
-* Returns whether the reader has consumed the input.
-*/
-   boolean isFinished();
-
-   // 

-   // Task events
-   // 

-
-   void sendTaskEvent(TaskEvent event) throws IOException;
-
-   void registerTaskEventListener(EventListener listener, 
Class eventType);
-
-   // 

-   // Iterations
-   // 

+public interface IterationReader {
 
void setIterativeReader();
 
void startNextSuperstep();
 
boolean hasReachedEndOfSuperstep();
 
+   /**
+* Returns whether the reader has consumed the input.
+*/
+   boolean isFinished();
 
 Review comment:
   Yes, I just confirmed it is actually only used in iteration, so all the 
current methods in `ReaderBase` are for iteration. If we change it to 
`IterationReader`, the corresponding `AbstractReader` should also be changed to 
`AbstractIterationReader`, because the current `AbstractReader` is also only 
for iteration.
   
   But I think it still seems a little strange to let `IterationReader` in the 
upper layer, because the current `Reader` interface which is used for common 
read extends the `IterationReader`. This relationship seems not make sense.
   
   If we have two independent reader base interfaces, and one is for iteration, 
the other is for common case. Then the specific record reader can implement 
both of interfaces for iteration scenario or only implement common reader 
interface for non-iteration scenario.
   
   So it may need reorganize the current relationships if we want to change 
this part. Easily change the name to `IterationReader` may bring literal 
confusing.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor org.apache.flink.runtime.io.network.api.reader…

2018-10-24 Thread GitBox
zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor 
org.apache.flink.runtime.io.network.api.reader…
URL: https://github.com/apache/flink/pull/6911#discussion_r228020917
 
 

 ##
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/IterationReader.java
 ##
 @@ -21,34 +21,21 @@
 import org.apache.flink.runtime.event.TaskEvent;
 import org.apache.flink.runtime.util.event.EventListener;
 
-import java.io.IOException;
-
 /**
- * The basic API for every reader.
+ * Reader for iteration.
  */
-public interface ReaderBase {
-
-   /**
-* Returns whether the reader has consumed the input.
-*/
-   boolean isFinished();
-
-   // 

-   // Task events
-   // 

-
-   void sendTaskEvent(TaskEvent event) throws IOException;
-
-   void registerTaskEventListener(EventListener listener, 
Class eventType);
-
-   // 

-   // Iterations
-   // 

+public interface IterationReader {
 
void setIterativeReader();
 
void startNextSuperstep();
 
boolean hasReachedEndOfSuperstep();
 
+   /**
+* Returns whether the reader has consumed the input.
+*/
+   boolean isFinished();
 
 Review comment:
   Yes, I just confirmed it is actually only used in iteration, so all the 
current methods in `ReaderBase` are for iteration. If we change it to 
`IterationReaderBase`, the corresponding `AbstractReader` should also be 
changed to `AbstractIterationReader`, because the current `AbstractReader` is 
also only for iteration.
   
   But I think it still seems a little strange to let `IterationReaderBase` in 
the upper layer, because the current `Reader` interface which is used for 
common read extends the `IterationReaderBase`. This relationship seems not make 
sense.
   
   If we have two independent reader base interfaces, and one is for iteration, 
the other is for common case. Then the specific record reader can implement 
both of interfaces for iteration scenario or only implement common reader 
interface for non-iteration scenario.
   
   So it may need reorganize the current relationships if we want to change 
this part. Easily change the name to `IterationReaderBase` may bring literal 
confusing.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor org.apache.flink.runtime.io.network.api.reader…

2018-10-23 Thread GitBox
zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor 
org.apache.flink.runtime.io.network.api.reader…
URL: https://github.com/apache/flink/pull/6911#discussion_r227654747
 
 

 ##
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/TaskEventSender.java
 ##
 @@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.io.network.api.reader;
+
+import org.apache.flink.runtime.event.TaskEvent;
+
+import java.io.IOException;
+
+/**
+ * The basic API for every reader.
+ */
+public interface TaskEventSender {
+
+   void sendTaskEvent(TaskEvent event) throws IOException;
 
 Review comment:
   Currently `sendTaskEvent` is only used for iteration scenarios, so I think 
it may also make sense if covering in `IterationReader` similar with 
`registerTaskEventListener`. Only when we consider to extend other `TaskEvent` 
in future to make it a separate interface for common cases.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor org.apache.flink.runtime.io.network.api.reader…

2018-10-23 Thread GitBox
zhijiangW commented on a change in pull request #6911: [FLINK-10656] Refactor 
org.apache.flink.runtime.io.network.api.reader…
URL: https://github.com/apache/flink/pull/6911#discussion_r227654121
 
 

 ##
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/IterationReader.java
 ##
 @@ -21,34 +21,21 @@
 import org.apache.flink.runtime.event.TaskEvent;
 import org.apache.flink.runtime.util.event.EventListener;
 
-import java.io.IOException;
-
 /**
- * The basic API for every reader.
+ * Reader for iteration.
  */
-public interface ReaderBase {
-
-   /**
-* Returns whether the reader has consumed the input.
-*/
-   boolean isFinished();
-
-   // 

-   // Task events
-   // 

-
-   void sendTaskEvent(TaskEvent event) throws IOException;
-
-   void registerTaskEventListener(EventListener listener, 
Class eventType);
-
-   // 

-   // Iterations
-   // 

+public interface IterationReader {
 
void setIterativeReader();
 
void startNextSuperstep();
 
boolean hasReachedEndOfSuperstep();
 
+   /**
+* Returns whether the reader has consumed the input.
+*/
+   boolean isFinished();
 
 Review comment:
   I think `isFinished` method is not strong correlation of iteration, and it 
should be a very common method suitable for all readers.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services