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.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to