use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestSimpleExternalSort method mergeSortWithSv2.
/**
* Tests the external sort using an in-memory sort. Relies on default memory
* settings to be large enough to do the in-memory sort (there is,
* unfortunately, no way to double-check that no spilling was done.)
* This must be checked manually by setting a breakpoint in the in-memory
* sort routine.
*
* @param testLegacy
* @throws Exception
*/
private void mergeSortWithSv2(boolean testLegacy) throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).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_sv2.json").results();
assertEquals(500_000, client.countResults(results));
validateResults(client.allocator(), results);
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestSimpleExternalSort method sortOneKeyDescendingMergeSort.
private void sortOneKeyDescendingMergeSort(boolean testLegacy) throws Throwable {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).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.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testSessionPrecedence.
/* Test if altering session option takes precedence over system option */
@Test
public void testSessionPrecedence() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).systemOption(ExecConstants.SLICE_TARGET, 100000);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.queryBuilder().sql("ALTER SESSION SET `planner.slice_target` = 10000").run();
String slice_target = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.slice_target' and optionScope = 'SESSION'", 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 testScope.
/* Test if the scope is set during BOOT time and scope is actually BOOT */
@Test
public void testScope() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).setOptionDefault(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("BOOT", scope);
}
}
use of org.apache.drill.test.ClientFixture in project drill by axbaretto.
the class TestConfigLinkage method testAlterInternalSystemOption.
@Test
public void testAlterInternalSystemOption() throws Exception {
OptionDefinition optionDefinition = createMockPropOptionDefinition();
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").putDefinition(optionDefinition);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.queryBuilder().sql("ALTER SYSTEM SET `%s` = 'bleh'", MOCK_PROPERTY).run();
client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS.getTableName()).printCsv();
client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS_VAL.getTableName()).printCsv();
String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS, MOCK_PROPERTY).singletonString();
String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL, MOCK_PROPERTY).singletonString();
assertEquals("bleh", mockProp);
assertEquals("bleh", mockProp2);
}
}
Aggregations