sanha commented on a change in pull request #193: [NEMO-338] SkewSamplingPass
URL: https://github.com/apache/incubator-nemo/pull/193#discussion_r257171773
##########
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:
Is this code needed? The result will be the same without this if clause.
----------------------------------------------------------------
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