wonook commented on a change in pull request #23: [NEMO-67] Fix Communication 
Pattern for Beam CoGroupByKey transform
URL: https://github.com/apache/incubator-nemo/pull/23#discussion_r190807947
 
 

 ##########
 File path: 
compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/NemoPipelineVisitor.java
 ##########
 @@ -241,6 +241,19 @@ private static BeamCoder getCoderForView(final ViewFn 
viewFn, final Coder beamIn
    */
   private static DataCommunicationPatternProperty.Value 
getEdgeCommunicationPattern(final IRVertex src,
                                                                                
     final IRVertex dst) {
+    try {
+      final Class<?> constructUnionTableFn = Class.forName(
+          
"org.apache.beam.sdk.transforms.join.CoGroupByKey$ConstructUnionTableFn");
+      if (src instanceof OperatorVertex && ((OperatorVertex) 
src).getTransform() instanceof DoTransform
+          && ((DoTransform) ((OperatorVertex) 
src).getTransform()).getDoFn().getClass().equals(constructUnionTableFn)) {
+        return DataCommunicationPatternProperty.Value.Shuffle;
+      }
+    } catch (final ClassNotFoundException e) {
+      throw new RuntimeException(e);
+    }
+    if (src instanceof OperatorVertex && ((OperatorVertex) src).getTransform() 
instanceof FlattenTransform) {
 
 Review comment:
   Isn't this case already handled in the code below?
   If you want to make it explicit, why not add a comment or include it in the 
if-else statement below?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to