You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/12/24 11:42:39 UTC

[GitHub] vdiravka commented on a change in pull request #1584: DRILL-6922: Separate Session and Query options on Web UI

vdiravka commented on a change in pull request #1584: DRILL-6922: Separate Session and Query options on Web UI
URL: https://github.com/apache/drill/pull/1584#discussion_r243775914
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
 ##########
 @@ -303,22 +305,35 @@ public String getOperatorsJSON() {
     return sb.append("}").toString();
   }
 
+  public Map<String, String> getSessionOptions() {
+    return getOptions(o -> OptionValue.OptionScope.SESSION == o.getScope());
+  }
+
+  public Map<String, String> getQueryOptions() {
+    return getOptions(o -> OptionValue.OptionScope.QUERY == o.getScope());
+  }
+
   /**
    * Generates sorted map with properties used to display on Web UI,
    * where key is property name and value is property string value.
+   * Options are filtered based on {@link OptionValue.OptionScope}.
+   * <p/>
    * When property value is null, it would be replaced with 'null',
    * this is achieved using {@link String#valueOf(Object)} method.
    * Options will be stored in ascending key order, sorted according
    * to the natural order for the option name represented by {@link String}.
    *
+   * @param filter filter based on {@link OptionValue.OptionScope}
    * @return map with properties names and string values
    */
-  public Map<String, String> getOptions() {
-    final Map<String, String> map = Maps.newTreeMap();
-    for (OptionValue option : options) {
-      map.put(option.getName(), String.valueOf(option.getValue()));
-    }
-    return map;
+  private Map<String, String> getOptions(Predicate<OptionValue> filter) {
 
 Review comment:
   It is fine to get specific scope options. 
   But how to get all options? Or it is not necessary, therefore such getter is removed, isn't it?
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services