Search in sources :

Example 16 with ClientFixture

use of org.apache.drill.test.ClientFixture in project drill by axbaretto.

the class TestConfigLinkage method testMaxWidthPerNodeSystem.

/* Test if setting maxwidth at system level takes precedence */
@Test
public void testMaxWidthPerNodeSystem() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).systemOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 3);
    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 = 'SYSTEM'", SystemTable.OPTION_VAL.getTableName()).singletonString();
        assertEquals("3", maxWidth);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 17 with ClientFixture

use of org.apache.drill.test.ClientFixture in project drill by axbaretto.

the class TestConfigLinkage method testMaxWidthPerNodeConfig.

/* Test if setting maxwidth option through config takes effect */
@Test
public void testMaxWidthPerNodeConfig() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).setOptionDefault(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 = 'BOOT'", SystemTable.OPTION_VAL.getTableName()).singletonString();
        assertEquals("2", maxWidth);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 18 with ClientFixture

use of org.apache.drill.test.ClientFixture in project drill by axbaretto.

the class StatusResourcesTest method testRetrieveInternalOption.

@Test
public void testRetrieveInternalOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        StatusResources.OptionWrapper option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("a", option.getValueAsString());
        client.alterSystem(MOCK_PROPERTY, "c");
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("c", option.getValueAsString());
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) TestConfigLinkage.createMockPropOptionDefinition(org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition) Test(org.junit.Test)

Example 19 with ClientFixture

use of org.apache.drill.test.ClientFixture in project drill by axbaretto.

the class TestConfigLinkage method testAlterSystem.

/* Test if altering system option takes precedence over config option */
@Test
public void testAlterSystem() throws Exception {
    try (ClusterFixture cluster = ClusterFixture.standardCluster(dirTestWatcher);
        ClientFixture client = cluster.clientFixture()) {
        client.queryBuilder().sql("ALTER SYSTEM SET `planner.slice_target` = 10000").run();
        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");
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 20 with ClientFixture

use of org.apache.drill.test.ClientFixture in project drill by apache.

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.OPTIONS.getTableName(), PlannerSettings.PARQUET_ROWGROUP_FILTER_PUSHDOWN_PLANNING_THRESHOLD_KEY).singletonString();
        String plannerWidth = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.OPTIONS.getTableName(), ExecConstants.MAX_WIDTH_GLOBAL_KEY).singletonString();
        Assert.assertEquals("30000", parquetPushdown);
        Assert.assertEquals("3333", plannerWidth);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) File(java.io.File)

Aggregations

ClientFixture (org.apache.drill.test.ClientFixture)122 Test (org.junit.Test)102 ClusterFixture (org.apache.drill.test.ClusterFixture)99 ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)89 SlowTest (org.apache.drill.categories.SlowTest)46 OptionsTest (org.apache.drill.categories.OptionsTest)36 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)28 BaseTest (org.apache.drill.test.BaseTest)20 ClusterTest (org.apache.drill.test.ClusterTest)16 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)12 DrillTest (org.apache.drill.test.DrillTest)10 OperatorTest (org.apache.drill.categories.OperatorTest)8 UserRemoteException (org.apache.drill.common.exceptions.UserRemoteException)7 RestClientFixture (org.apache.drill.test.RestClientFixture)4 ArrayList (java.util.ArrayList)3 SchemaPath (org.apache.drill.common.expression.SchemaPath)3 RecordBatchLoader (org.apache.drill.exec.record.RecordBatchLoader)3 BigIntVector (org.apache.drill.exec.vector.BigIntVector)3 File (java.io.File)2 PlanFragment (org.apache.drill.exec.proto.BitControl.PlanFragment)2