use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testScopeSession.
/* Test if the option is set at SESSION scope and the scope is actually SESSION */
@Test
public void testScopeSession() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).sessionOption(ExecConstants.SLICE_TARGET, 100000);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String scope = client.queryBuilder().sql("SELECT optionScope from sys.%s where name='planner.slice_target'", SystemTable.OPTION_VAL.getTableName()).singletonString();
Assert.assertEquals("SESSION", scope);
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testSystemOption.
/* Test if system option takes precedence over the boot option */
@Test
public void testSystemOption() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).systemOption(ExecConstants.SLICE_TARGET, 10000);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String slice_target = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.slice_target' and optionScope = 'SYSTEM'", SystemTable.OPTION_VAL.getTableName()).singletonString();
assertEquals(slice_target, "10000");
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testConfigOption.
/* Test if config option takes precedence if config option is not set */
@Test
public void testConfigOption() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).setOptionDefault(ExecConstants.SLICE_TARGET, 1000);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String slice_target = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.slice_target' and optionScope = 'BOOT'", SystemTable.OPTION_VAL.getTableName()).singletonString();
assertEquals(slice_target, "1000");
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testDefaultValidatorInternalValue.
@Test
public void testDefaultValidatorInternalValue() throws Exception {
OptionDefinition optionDefinition = createMockPropOptionDefinition();
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).putDefinition(optionDefinition).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a");
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS.getTableName(), MOCK_PROPERTY).singletonString();
String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL.getTableName(), MOCK_PROPERTY).singletonString();
assertEquals("a", mockProp);
assertEquals("a", mockProp2);
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testScopeAlterSystem.
/* Test if the option is altered at SYSTEM scope and the scope is actually SYSTEM */
@Test
public void testScopeAlterSystem() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.queryBuilder().sql("ALTER SYSTEM set `planner.slice_target`= 10000").run();
String scope = client.queryBuilder().sql("SELECT optionScope from sys.%s where name='planner.slice_target'", SystemTable.OPTION_VAL.getTableName()).singletonString();
Assert.assertEquals("SYSTEM", scope);
}
}
Aggregations