[
https://issues.apache.org/jira/browse/DRILL-5547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105701#comment-16105701
]
ASF GitHub Bot commented on DRILL-5547:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/868#discussion_r130189085
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/test/TestConfigLinkage.java ---
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.test;
+
+import org.apache.drill.exec.ExecConstants;
+import org.junit.Test;
+import org.apache.drill.common.config.DrillConfig;
+import static org.junit.Assert.assertEquals;
+/*
+ * Tests to test if the linkage between the two config option systems
+ * i.e., the linkage between boot-config system and system/session options.
+ * Tests to assert if the config options are read in the order of session
,system, boot-config */
+
+public class TestConfigLinkage {
+
+ /* Test if session option takes precendence */
+ @Test
+ public void testSessionOption() throws Exception {
+ FixtureBuilder builder =
ClusterFixture.builder().sessionOption(ExecConstants.SLICE_TARGET, 10);
+ try (ClusterFixture cluster = builder.build();
+ ClientFixture client = cluster.clientFixture()) {
+ String slice_target = client.queryBuilder().sql("SELECT val FROM
sys.options2 where name='planner.slice_target'").singletonString();
+ assertEquals(slice_target,"10");
+ }
+ }
+
+ /* Test if system option takes precendence */
+ @Test
+ public void testSystemOption() throws Exception {
+ FixtureBuilder builder =
ClusterFixture.builder().systemOption(ExecConstants.SLICE_TARGET, 20);
+ try (ClusterFixture cluster = builder.build();
+ ClientFixture client = cluster.clientFixture()) {
+ String slice_target = client.queryBuilder().sql("SELECT val FROM
sys.options2 where name='planner.slice_target'").singletonString();
+ assertEquals(slice_target,"20");
+ }
+ }
+
+ /* Test if config option takes precedence if config option is not set */
+ @Test
+ public void testConfigOption() throws Exception {
+ FixtureBuilder builder = ClusterFixture.builder()
+
.configProperty("drill.exec.options."+ExecConstants.SLICE_TARGET, 30);
--- End diff --
Maybe add a new method to the fixture builder:
`setOptionDefault(ExecConstants.SLICE_TARGET, Object value)`
Then, inside this method, append the prefix. For the prefix, refer to a
constant defined somewhere for the value.
> Drill config options and session options do not work as intended
> ----------------------------------------------------------------
>
> Key: DRILL-5547
> URL: https://issues.apache.org/jira/browse/DRILL-5547
> Project: Apache Drill
> Issue Type: Bug
> Components: Server
> Affects Versions: 1.10.0
> Reporter: Karthikeyan Manivannan
> Assignee: Venkata Jyothsna Donapati
> Fix For: Future
>
>
> In Drill, session options should take precedence over config options. But
> several of these session options are assigned hard-coded default values when
> the option validators are initialized. Because of this config options will
> never be read and honored even if the user did not specify the session
> option.
> ClassCompilerSelector.JAVA_COMPILER_VALIDATOR uses CompilerPolicy.DEFAULT as
> the default value. This default value gets into the session options map via
> the initialization of validators in SystemOptionManager.
> Now any piece of code that tries to check if a session option is set will
> never see a null, so it will always use that value and never try to look into
> the config options. For example, in the following piece of code from
> ClassCompilerSelector (), the policy will never be read from the config file.
> policy = CompilerPolicy.valueOf((value != null) ?
> value.string_val.toUpperCase() :
> config.getString(JAVA_COMPILER_CONFIG).toUpperCase());
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)