use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestSimpleExternalSort method sortOneKeyDescendingExternalSort.
private void sortOneKeyDescendingExternalSort(boolean testLegacy) throws Throwable {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD, 4).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE, 4).configProperty(ExecConstants.EXTERNAL_SORT_BATCH_LIMIT, 4).configProperty(ExecConstants.EXTERNAL_SORT_DISABLE_MANAGED, false);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
chooseImpl(client, testLegacy);
List<QueryDataBatch> results = client.queryBuilder().physicalResource("/xsort/one_key_sort_descending.json").results();
assertEquals(1_000_000, client.countResults(results));
validateResults(client.allocator(), results);
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestSortSpillWithException method setup.
@BeforeClass
public static void setup() throws Exception {
dirTestWatcher.copyResourceToRoot(Paths.get("xsort"));
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD, // Unmanaged
1).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE, // Unmanaged
1).configProperty(ExecConstants.EXTERNAL_SORT_MAX_MEMORY, 10 * 1024 * 1024).sessionOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, // Spill early
60 * 1024 * 1024).sessionOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.0).configProperty(ExecConstants.EXTERNAL_SORT_DISABLE_MANAGED, false).maxParallelization(1);
startCluster(builder);
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.
the class TestOrderedMuxExchange method testLimitOnOrderedMuxWindow.
/**
* Test case to verify the OrderedMuxExchange created for order by with limit and window agg.
* It checks that the limit is pushed down the OrderedMuxExchange.
*
* @throws Exception if anything goes wrong
*/
@Test
public void testLimitOnOrderedMuxWindow() 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 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 testOrderedMuxForOrderBy.
/**
* Test case to verify the OrderedMuxExchange created for order by clause.
* 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 testOrderedMuxForOrderBy() 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";
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 TestPStoreProviders method localLoadTestHelper.
private void localLoadTestHelper(String propertiesDir) throws Exception {
File localOptionsResources = new File(propertiesDir);
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.SYS_STORE_PROVIDER_CLASS, LocalPersistentStoreProvider.class.getCanonicalName()).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, true);
File optionsDir = new File(dirTestWatcher.getStoreDir(), "sys.options");
optionsDir.mkdirs();
org.apache.commons.io.FileUtils.copyDirectory(localOptionsResources, optionsDir);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String parquetPushdown = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.OPTION_VAL.getTableName(), PlannerSettings.PARQUET_ROWGROUP_FILTER_PUSHDOWN_PLANNING_THRESHOLD_KEY).singletonString();
String plannerWidth = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.OPTION_VAL.getTableName(), ExecConstants.MAX_WIDTH_GLOBAL_KEY).singletonString();
Assert.assertEquals("30000", parquetPushdown);
Assert.assertEquals("3333", plannerWidth);
}
}
Aggregations