Github user kkhatua commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1141#discussion_r171648058
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentStats.java ---
    @@ -79,4 +71,21 @@ public void addOperatorStats(OperatorStats stats) {
         operators.add(stats);
       }
     
    +  //DRILL-6197
    +  public OperatorStats addOrReplaceOperatorStats(OperatorStats stats) {
    +    //Remove existing stat
    +    OperatorStats replacedStat = null;
    +    int index = 0;
    +    for (OperatorStats opStat : operators) {
    --- End diff --
    
    The choice for using a list for the collection of stats seems to be because 
it simply gets serialized into a JSON list. . As for the overhead, since each 
list is specific to a minor fragment (which typically has about 3-8 operators), 
the overhead of doing a linear search is not significant and is invoked only 
for specific operators. That is one of the reasons why I didn't modify the 
original `addOperatorStats()` implementation with that of 
`addOrReplaceOperatorStats()`.


---

Reply via email to