Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C0D01200D10 for ; Sat, 26 Aug 2017 00:25:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BF64C16D6A1; Fri, 25 Aug 2017 22:25:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0F4AE16D69E for ; Sat, 26 Aug 2017 00:25:22 +0200 (CEST) Received: (qmail 73173 invoked by uid 500); 25 Aug 2017 22:25:20 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 73162 invoked by uid 99); 25 Aug 2017 22:25:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Aug 2017 22:25:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6EF7AF5EF3; Fri, 25 Aug 2017 22:25:20 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill issue #868: DRILL-5547:Linking config options with system option manag... Content-Type: text/plain Message-Id: <20170825222520.6EF7AF5EF3@git1-us-west.apache.org> Date: Fri, 25 Aug 2017 22:25:20 +0000 (UTC) archived-at: Fri, 25 Aug 2017 22:25:23 -0000 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. ---