use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class DrillSeparatePlanningTest method testSetup.
@Before
public void testSetup() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).clusterSize(2);
startCluster(builder);
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestConfigLinkage method testMaxWidthPerNodeDefault.
/* Test if max width is computed correctly using the cpu load average
when the option is not set at either system or session level
*/
@Test
public void testMaxWidthPerNodeDefault() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).setOptionDefault(ExecConstants.CPU_LOAD_AVERAGE_KEY, 0.70);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
long maxWidth = ExecConstants.MAX_WIDTH_PER_NODE.computeMaxWidth(0.70, 0);
int availProc = Runtime.getRuntime().availableProcessors();
long maxWidthPerNode = Math.max(1, Math.min(availProc, Math.round(availProc * 0.70)));
assertEquals(maxWidthPerNode, maxWidth);
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestConfigLinkage method testMaxWidthPerNodeSession.
/* Test if setting maxwidth at session level takes precedence */
@Test
public void testMaxWidthPerNodeSession() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).sessionOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 2);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String maxWidth = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.width.max_per_node' and optionScope = 'SESSION'", SystemTable.OPTION_VAL.getTableName()).singletonString();
assertEquals("2", maxWidth);
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestConfigLinkage method testScopeSystem.
/* Test if the option is set at SYSTEM scope and the scope is actually SYSTEM */
@Test
public void testScopeSystem() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).systemOption(ExecConstants.SLICE_TARGET, 10000);
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("SYSTEM", scope);
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestConfigLinkage method testScopeAlterSession.
/* Test if the option is altered at SESSION scope and the scope is actually SESSION */
@Test
public void testScopeAlterSession() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.queryBuilder().sql("ALTER SESSION 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("SESSION", scope);
}
}
Aggregations