Search in sources :

Example 36 with ClientFixture

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

the class TestConfigLinkage method testSessionOption.

/* Test if session option takes precedence */
@Test
public void testSessionOption() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).sessionOption(ExecConstants.SLICE_TARGET, 10);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String slice_target = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.slice_target' and optionScope = 'SESSION'", SystemTable.OPTIONS.getTableName()).singletonString();
        assertEquals(slice_target, "10");
    }
}
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) BaseTest(org.apache.drill.test.BaseTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 37 with ClientFixture

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

the class TestConfigLinkage method testSystemOption.

/* Test if system option takes precedence over the boot option */
@Test
public void testSystemOption() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).systemOption(ExecConstants.SLICE_TARGET, 10000);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String slice_target = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.slice_target' and optionScope = 'SYSTEM'", SystemTable.OPTIONS.getTableName()).singletonString();
        assertEquals(slice_target, "10000");
    }
}
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) BaseTest(org.apache.drill.test.BaseTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 38 with ClientFixture

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

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.OPTIONS.getTableName()).singletonString();
        Assert.assertEquals("SESSION", scope);
    }
}
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) BaseTest(org.apache.drill.test.BaseTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 39 with ClientFixture

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

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_OLD.getTableName()).logCsv();
        client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS.getTableName()).logCsv();
        String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_OLD, MOCK_PROPERTY).singletonString();
        String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS, MOCK_PROPERTY).singletonString();
        assertEquals("bleh", mockProp);
        assertEquals("bleh", mockProp2);
    }
}
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) BaseTest(org.apache.drill.test.BaseTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 40 with ClientFixture

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

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.OPTIONS.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) BaseTest(org.apache.drill.test.BaseTest) SlowTest(org.apache.drill.categories.SlowTest)

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