use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TopNBatchTest method sortOneKeyAscending.
/**
* End to end test of the TopN operator.
* @throws Throwable
*/
@Test
public void sortOneKeyAscending() throws Throwable {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
TestBuilder testBuilder = new TestBuilder(new ClusterFixture.FixtureTestServices(client));
testBuilder.ordered().physicalPlanFromFile("topN/one_key_sort.json").baselineColumns("blue").go();
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestHashAggrSpill method testSpill.
/**
* A template for Hash Aggr spilling tests
*
* @throws Exception
*/
private void testSpill(long maxMem, long numPartitions, long minBatches, int maxParallel, boolean fallback, boolean predict, String sql, long expectedRows, int cycle, int fromPart, int toPart) throws Exception {
LogFixture.LogFixtureBuilder logBuilder = LogFixture.builder().toConsole().logger("org.apache.drill", Level.WARN);
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).sessionOption(ExecConstants.HASHAGG_MAX_MEMORY_KEY, maxMem).sessionOption(ExecConstants.HASHAGG_NUM_PARTITIONS_KEY, numPartitions).sessionOption(ExecConstants.HASHAGG_MIN_BATCHES_PER_PARTITION_KEY, minBatches).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).sessionOption(PlannerSettings.FORCE_2PHASE_AGGR_KEY, true).sessionOption(ExecConstants.HASHAGG_FALLBACK_ENABLED_KEY, fallback).sessionOption(ExecConstants.HASHAGG_USE_MEMORY_PREDICTION_KEY, predict).maxParallelization(maxParallel).saveProfiles();
String sqlStr = // if null then use this default query
sql != null ? // if null then use this default query
sql : "SELECT empid_s17, dept_i, branch_i, AVG(salary_i) FROM `mock`.`employee_1200K` GROUP BY empid_s17, dept_i, branch_i";
try (LogFixture logs = logBuilder.build();
ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
runAndDump(client, sqlStr, expectedRows, cycle, fromPart, toPart);
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestOrderedMuxExchange method testLimitOnOrderedMux.
/**
* Test case to verify the OrderedMuxExchange created for order by with limit.
* It checks that the limit is pushed down the OrderedMuxExchange.
*
* @throws Exception if anything goes wrong
*/
@Test
public void testLimitOnOrderedMux() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).maxParallelization(1).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, true);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.alterSession(ExecConstants.SLICE_TARGET, 10);
String sql = "SELECT emp_id, emp_name FROM dfs.`empTable` e order BY emp_name, emp_id limit 10";
client.testBuilder().unOrdered().optionSettingQueriesForTestQuery("alter session set `planner.slice_target` = 10;").sqlQuery(sql).optionSettingQueriesForBaseline(// Use default option setting.
"alter session set `planner.enable_ordered_mux_exchange` = false").sqlBaselineQuery(sql).build().run();
client.alterSession(ExecConstants.ORDERED_MUX_EXCHANGE, true);
String explainText = client.queryBuilder().sql(sql).explainText();
assertTrue(explainText.matches(String.format(MATCH_PATTERN_ACROSS_LINES + "%s" + MATCH_PATTERN_ACROSS_LINES + "%s" + MATCH_PATTERN_ACROSS_LINES, ORDERED_MUX_EXCHANGE, TOPN)));
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestOrderedMuxExchange method testOrderedMuxForWindowAgg.
/**
* Test case to verify the OrderedMuxExchange created for window functions.
* It checks by forcing the plan to create OrderedMuxExchange and also verifies the
* output column is ordered.
*
* @throws Exception if anything goes wrong
*/
@Test
public void testOrderedMuxForWindowAgg() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).maxParallelization(1).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, true);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.alterSession(ExecConstants.SLICE_TARGET, 10);
String sql = "SELECT emp_name, max(emp_id) over (order by emp_name) FROM dfs.`empTable` e order BY emp_name";
client.testBuilder().unOrdered().optionSettingQueriesForTestQuery("alter session set `planner.slice_target` = 10;").sqlQuery(sql).optionSettingQueriesForBaseline(// Use default option setting.
"alter session set `planner.enable_ordered_mux_exchange` = false").sqlBaselineQuery(sql).build().run();
client.alterSession(ExecConstants.ORDERED_MUX_EXCHANGE, true);
String explainText = client.queryBuilder().sql(sql).explainText();
assertTrue(explainText.contains(ORDERED_MUX_EXCHANGE));
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestValidationOptions method testConfig.
/**
* Config options override session options. Config options allow passing in
* the setting at run time on the command line. This is a work-around for the
* fact that the config system has no generic solution at present.
*
* @throws Exception if anything goes wrong
*/
@Test
public void testConfig() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).maxParallelization(1).configProperty(ExecConstants.ENABLE_ITERATOR_VALIDATION, true).configProperty(ExecConstants.ENABLE_VECTOR_VALIDATION, true).sessionOption(ExecConstants.ENABLE_ITERATOR_VALIDATION_OPTION, false).sessionOption(ExecConstants.ENABLE_VECTOR_VALIDATION_OPTION, false);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
boolean hasAssertions = false;
assert hasAssertions = true;
assertFalse(hasAssertions);
String sql = "SELECT id_i, name_s10 FROM `mock`.`customers_10`";
client.queryBuilder().sql(sql).run();
}
}
Aggregations