From notifications-return-125-archive-asf-public=cust-asf.ponee.io@nemo.apache.org Wed Feb 20 07:27:18 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BD37018075F for ; Wed, 20 Feb 2019 08:27:17 +0100 (CET) Received: (qmail 52868 invoked by uid 500); 20 Feb 2019 07:27:16 -0000 Mailing-List: contact notifications-help@nemo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nemo.apache.org Delivered-To: mailing list notifications@nemo.apache.org Received: (qmail 52841 invoked by uid 99); 20 Feb 2019 07:27:16 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2019 07:27:16 +0000 From: GitBox To: notifications@nemo.apache.org Subject: [GitHub] johnyangk commented on a change in pull request #193: [NEMO-338] SkewSamplingPass Message-ID: <155064763619.4637.6432694808233934964.gitbox@gitbox.apache.org> Date: Wed, 20 Feb 2019 07:27:16 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit johnyangk commented on a change in pull request #193: [NEMO-338] SkewSamplingPass URL: https://github.com/apache/incubator-nemo/pull/193#discussion_r258349827 ########## File path: common/src/main/java/org/apache/nemo/common/Util.java ########## @@ -51,4 +59,90 @@ public static boolean checkEqualityOfIntPredicates(final IntPredicate firstPredi return true; } + /** + * @param edgeToClone to copy execution properties from. + * @param newSrc of the new edge. + * @param newDst of the new edge. + * @return the new edge. + */ + public static IREdge cloneEdge(final IREdge edgeToClone, + final IRVertex newSrc, + final IRVertex newDst) { + return cloneEdge( + edgeToClone.getPropertyValue(CommunicationPatternProperty.class).get(), edgeToClone, newSrc, newDst); + } + + /** + * Creates a new edge with several execution properties same as the given edge. + * The copied execution properties include those minimally required for execution, such as encoder/decoders. + * + * @param commPattern to use. + * @param edgeToClone to copy execution properties from. + * @param newSrc of the new edge. + * @param newDst of the new edge. + * @return the new edge. + */ + public static IREdge cloneEdge(final CommunicationPatternProperty.Value commPattern, + final IREdge edgeToClone, + final IRVertex newSrc, + final IRVertex newDst) { + final IREdge clone = new IREdge(commPattern, newSrc, newDst); + + if (edgeToClone.getPropertySnapshot().containsKey(EncoderProperty.class)) { + clone.setProperty(edgeToClone.getPropertySnapshot().get(EncoderProperty.class)); + } else { + clone.setProperty(EncoderProperty.of(edgeToClone.getPropertyValue(EncoderProperty.class).get())); + } + + if (edgeToClone.getPropertySnapshot().containsKey(DecoderProperty.class)) { + clone.setProperty(edgeToClone.getPropertySnapshot().get(DecoderProperty.class)); + } else { + clone.setProperty(DecoderProperty.of(edgeToClone.getPropertyValue(DecoderProperty.class).get())); + } + + edgeToClone.getPropertyValue(AdditionalOutputTagProperty.class).ifPresent(tag -> { + clone.setProperty(AdditionalOutputTagProperty.of(tag)); + }); + + edgeToClone.getPropertyValue(PartitionerProperty.class).ifPresent(p -> { + if (p.right() == PartitionerProperty.NUM_EQUAL_TO_DST_PARALLELISM) { Review comment: It is needed. Please see: https://github.com/apache/incubator-nemo/blob/master/common/src/main/java/org/apache/nemo/common/ir/edge/executionproperty/PartitionerProperty.java#L66 ---------------------------------------------------------------- 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