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

    https://github.com/apache/drill/pull/987#discussion_r148123715
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
 ---
    @@ -76,12 +77,14 @@ public String getId() {
       public String getContent() {
         TableBuilder builder = new TableBuilder(OPERATOR_COLUMNS, 
OPERATOR_COLUMNS_TOOLTIP, true);
     
    +    Map<String, String> attributeMap = new HashMap<String, String>(); 
//Reusing for different fragments
         for (ImmutablePair<ImmutablePair<OperatorProfile, Integer>, String> ip 
: opsAndHosts) {
           int minor = ip.getLeft().getRight();
           OperatorProfile op = ip.getLeft().getLeft();
     
    +      attributeMap.put("data-order", String.valueOf(minor)); //Overwrite 
values from previous fragments
           String path = new 
OperatorPathBuilder().setMajor(major).setMinor(minor).setOperator(op).build();
    -      builder.appendCell(path);
    +      builder.appendCell(path, attributeMap);
    --- End diff --
    
    The appendCell() method has been overloaded with to allow for a map, from 
which any set of attributes can be injected. 
    
https://github.com/kkhatua/drill/blob/783ca992f3bbb52ae606a8ca10745d6dd2ed0d4f/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/TableBuilder.java#L95
    This allows for any future libraries that might need to inject their own 
set of attributes to be incorporated without the need for any significant 
modification to the TableBuilder.
    So, each appendCell is provided its own unique map that is consumed during 
the construction of the `<td>` element


---

Reply via email to