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/08/09 00:28:47 UTC

[GitHub] kkhatua commented on a change in pull request #1279: DRILL-5735: Allow search/sort in the Options webUI

kkhatua commented on a change in pull request #1279: DRILL-5735: Allow search/sort in the Options webUI
URL: https://github.com/apache/drill/pull/1279#discussion_r208775870
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/ExtendedOptionIterator.java
 ##########
 @@ -52,14 +55,44 @@
  *  only the value set at SESSION level.
  */
 public class ExtendedOptionIterator implements Iterator<Object> {
-//  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(OptionIterator.class);
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExtendedOptionIterator.class);
+  private static final String OPTIONS_DESCRIBE_PROPERTIES = "options.describe.properties";
+  private static final Properties descriptionMap = new Properties();
 
   private final OptionManager fragmentOptions;
   private final Iterator<OptionValue> mergedOptions;
+  private HashMap<OptionValue.Kind,String> typeMapping;
+  private Map<OptionScope, Integer> preference;
+
+  //Load & Provide a descriptions map
+  public static Properties getDescriptionMap() {
+      if (descriptionMap.isEmpty()) { //Expect a one time load
+        synchronized (descriptionMap) {
+          try (InputStream optionDescInputStream = OptionIterator.class.getClassLoader().getResourceAsStream(OPTIONS_DESCRIBE_PROPERTIES)) {
+            descriptionMap.load(optionDescInputStream);
+          } catch (IOException e) {
+            logger.warn("Unable to load descriptions from {}", OPTIONS_DESCRIBE_PROPERTIES);
+          }
+        }
+      }
+      return descriptionMap;
+  }
 
+  @SuppressWarnings("serial")
   public ExtendedOptionIterator(FragmentContext context, boolean internal) {
     fragmentOptions = context.getOptions();
-    final Iterator<OptionValue> optionList;
+    preference = new HashMap<OptionScope, Integer>() {{
 
 Review comment:
   This is just refactored code that I moved from elsewhere.  Since the entire statement is creating a constant map, this encapsulates that. Should I still make the change?

----------------------------------------------------------------
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