drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sohami <...@git.apache.org>
Subject [GitHub] drill pull request #753: DRILL-5260: Extend "Cluster Fixture" test framework
Date Thu, 23 Feb 2017 21:08:37 GMT
Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/753#discussion_r102610181
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/ProfileParser.java ---
    @@ -42,44 +48,207 @@
     public class ProfileParser {
     
       JsonObject profile;
    +  String query;
       List<String> plans;
    +  List<OpDefInfo> operations;
    +  Map<Integer,FragInfo> fragments = new HashMap<>();
    +  private List<OpDefInfo> topoOrder;
     
       public ProfileParser( File file ) throws IOException {
         try (FileReader fileReader = new FileReader(file);
              JsonReader reader = Json.createReader(fileReader)) {
           profile = (JsonObject) reader.read();
         }
    +
    +    parse();
    +  }
    +
    +  private void parse() {
    +    parseQuery();
    +    parsePlans();
    +    buildFrags();
    +    parseFragProfiles();
    +    mapOpProfiles();
    +    aggregateOpers();
    +    buildTree();
    +  }
    +
    +  private void parseQuery() {
    +    query = profile.getString("query");
    +    query = query.replace("//n", "\n");
    +  }
    +
    +  /**
    +   * Parse a text version of the plan as it appears in the JSON
    +   * query profile.
    +   */
    +
    +  private static class PlanParser {
    +
    +    List<String> plans = new ArrayList<>();
    +    List<OpDefInfo> operations = new ArrayList<>();
    +    List<OpDefInfo> sorted = new ArrayList<>();
    +
    +    public void parsePlans(String plan) {
    +      plans = new ArrayList<>( );
    +      String parts[] = plan.split("\n");
    +      for (String part : parts) {
    +        plans.add(part);
    +        OpDefInfo opDef = new OpDefInfo( part );
    +        operations.add(opDef);
    +      }
    +      sortList();
    +    }
    +
    +    public void sortList() {
    --- End diff --
    
    can be private.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message