nemo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nemo] wonook commented on a change in pull request #215: [NEMO-373] Optimize with DAG Patterns
Date Sun, 28 Apr 2019 02:13:58 GMT
wonook commented on a change in pull request #215: [NEMO-373] Optimize with DAG Patterns
URL: https://github.com/apache/incubator-nemo/pull/215#discussion_r279174438
 
 

 ##########
 File path: compiler/optimizer/src/main/java/org/apache/nemo/compiler/optimizer/OptimizerUtils.java
 ##########
 @@ -36,28 +46,72 @@ private OptimizerUtils() {
   }
 
   /**
-   * Restore the formatted string into a pair of vertex/edge id and the execution property.
+   * Restore the formatted string into a pair of vertex/edge list and the execution property.
    *
    * @param string the formatted string.
-   * @return a pair of vertex/edge id and the execution property key index.
+   * @param dag the IR DAG to observe.
+   * @return a pair of vertex/edge list and the execution property key index.
    */
-  public static Pair<String, Integer> stringToIdAndEPKeyIndex(final String string)
{
-    // Formatted into 9 digits: 0:vertex/edge 1-5:ID 5-9:EP Index.
+  public static Pair<List<Object>, Integer> stringToObjAndEPKeyIndex(final String
string, final IRDAG dag) {
+    // Formatted into 9 digits: 0:vertex/edge 1-4:ID 5-8:EP Index.
     if (string.length() != 9) {
       throw new InvalidParameterException("The metric data should follow the format of "
         + "[0]: index indicating vertex/edge, [1-4]: id of the component, and [5-8]: EP Key
index. Current: " + string);
     }
     final Integer idx = Integer.parseInt(string.substring(0, 1));
     final Integer numericId = Integer.parseInt(string.substring(1, 5));
-    final String id;
+    final List<Object> objectList = new ArrayList<>();
     if (idx == 1) {
-      id = Util.restoreVertexId(numericId);
+      final String id = Util.restoreVertexId(numericId);
+      objectList.add(dag.getVertexById(id));
     } else if (idx == 2) {
-      id = Util.restoreEdgeId(numericId);
+      final String id = Util.restoreEdgeId(numericId);
+      objectList.add(dag.getEdgeById(id));
     } else {
       throw new UnsupportedMethodException("The index " + idx + " cannot be categorized into
a vertex or an edge");
     }
-    return Pair.of(id, Integer.parseInt(string.substring(5, 9)));
+    return Pair.of(objectList, Integer.parseInt(string.substring(5, 9)));
+  }
+
+  /**
+   * Restore the formatted string into a pair of vertex/edge list and the execution property
index.
+   *
+   * @param string the formatted string, for patterns.
+   * @param dag the IR DAG to observe.
+   * @return a pair of vertex/edge list and the execution property key index.
+   */
+  public static Pair<List<Object>, Integer> patternStringToObjAndEPKeyIndex(final
String string, final IRDAG dag) {
+    // Formatted into 10 digits: 0:vertex/edge 1-3: patternID 4-5: vertex/edge 6-9:EP Index.
 
 Review comment:
   Fixed! Thanks for catching

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Mime
View raw message