seojangho 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_r191112708
 
 

 ##########
 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:
   ![screenshot from 2018-05-28 
14-13-24](https://user-images.githubusercontent.com/8655816/40598194-533a7b6a-6281-11e8-9b9a-297b5abe7aeb.png)
   
   Unfortunately, no. Without that `if` block, the method will return `Shuffle` 
pattern.

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

Reply via email to