You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nemo.apache.org by GitBox <gi...@apache.org> on 2018/12/10 06:22:16 UTC

[GitHub] johnyangk closed pull request #177: [NEMO-316] CombinePartial/FinalTransform is not disabled in streaming mode

johnyangk closed pull request #177: [NEMO-316] CombinePartial/FinalTransform is not disabled in streaming mode
URL: https://github.com/apache/incubator-nemo/pull/177
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/PipelineTranslator.java b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/PipelineTranslator.java
index 3e000d37f..7c6335751 100644
--- a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/PipelineTranslator.java
+++ b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/PipelineTranslator.java
@@ -341,7 +341,7 @@ private static void flattenTranslator(final PipelineTranslationContext ctx,
 
     // Check if the partial combining optimization can be applied.
     // If not, simply use the default Combine implementation by entering into it.
-    if (!isGlobalWindow(beamNode, ctx.getPipeline())) {
+    if (!(isMainInputBounded(beamNode, ctx.getPipeline()) && isGlobalWindow(beamNode, ctx.getPipeline()))) {
       // TODO #263: Partial Combining for Beam Streaming
       return Pipeline.PipelineVisitor.CompositeBehavior.ENTER_TRANSFORM;
     }
@@ -500,6 +500,7 @@ private static Transform createGBKTransform(
     }
   }
 
+
   /**
    * @param beamNode the beam node to be translated.
    * @param pipeline pipeline.
@@ -511,4 +512,16 @@ private static boolean isGlobalWindow(final TransformHierarchy.Node beamNode, fi
       Iterables.getOnlyElement(TransformInputs.nonAdditionalInputs(pTransform));
     return mainInput.getWindowingStrategy().getWindowFn() instanceof GlobalWindows;
   }
+
+  /**
+   * @param beamNode the beam node to be translated.
+   * @param pipeline pipeline.
+   * @return true if the main input bounded.
+   */
+  private static boolean isMainInputBounded(final TransformHierarchy.Node beamNode, final Pipeline pipeline) {
+    final AppliedPTransform pTransform = beamNode.toAppliedPTransform(pipeline);
+    final PCollection<?> mainInput = (PCollection<?>)
+      Iterables.getOnlyElement(TransformInputs.nonAdditionalInputs(pTransform));
+    return mainInput.isBounded() == PCollection.IsBounded.BOUNDED;
+  }
 }


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services