drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill issue #868: DRILL-5547:Linking config options with system option manag...
Date Fri, 25 Aug 2017 22:25:20 GMT
Github user paul-rogers commented on the issue:

    https://github.com/apache/drill/pull/868
  
    From a note sent by @dvjyothsna:
    
    All the system/session option default values are externalized to the conf file. Now the
options are looked up in the hierarchical order of SESSION - SYSTEM - CONFIG, the session
being given the highest precedence. So, if the user doesn't set system/session option by issuing
alter system/session, option manager fetches the value from the config.  Now we need not bother
about getting the value from config separately if it is not in the system/session level. For
example:
    
    ```
    OptionValue value = sessionOptions.getOption(JAVA_COMPILER_OPTION);
    policy = CompilerPolicy.valueOf((value != null)
        ? value.string_val.toUpperCase()
        : config.getString(JAVA_COMPILER_CONFIG)
    ```
    
    In the above code snippet we try to get option value and if it is not set (if it is null)
we try to get it from Config. With my code changes if the value is not set at system/session
level, value from the config is picked automatically.For example, the above can be simplified
to:
    
    ```
    policy = CompilerPolicy.valueOf(sessionOptions.getOption(JAVA_COMPILER_OPTION));
    ```
    
    I have already externalized all the existing options in ExecConstants, PlannerSettings,
etc., 
    to the drill-module.conf. Following are the steps to add a new system/session option.
    
    Steps to add a new system/session option:
    
    1. Add a validator in the ExecConstants.java or PlannerSettings.java or whichever is appropriate
for the option. For example: 
    ```
               String NEW_OPTION_KEY = "drill.exec.new_option";
    OptionValidator NEW_OPTION= new DoubleValidator(NEW_OPTION_KEY);
    ```
    2. Add the validator from the above step to the  validators list  in `SystemOptionManager.java`.
    
    3. Add the option in the conf file (for example, `drill-module.conf` or `drill-override.conf`
file ) under the name space `drill.exec.options`. For  example:
    ```
    	drill.exec.options : {
    		drill : {
    			exec : {
    				new_option : 1.5
    			}
    		}
    	 }
    ```
    
    4. Set the default value for the option in the conf file as shown above.
     	
    5. OptionManager loads default values from the conf file, User can override the default
values by issuing `ALTER SYSTEM/SESSION`.


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