Search in sources :

Example 61 with ClientFixture

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

the class TestValidationOptions method testOptions.

// To validate these tests, set breakpoints in ImplCreator
// and IteratorValidatorBatchIterator to see if the options
// work as expected.
@Test
public void testOptions() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).maxParallelization(1).configProperty(ExecConstants.ENABLE_ITERATOR_VALIDATION, false).configProperty(ExecConstants.ENABLE_VECTOR_VALIDATION, false).sessionOption(ExecConstants.ENABLE_ITERATOR_VALIDATION_OPTION, true).sessionOption(ExecConstants.ENABLE_VECTOR_VALIDATION_OPTION, true);
    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();
        client.alterSession(ExecConstants.ENABLE_VECTOR_VALIDATION, false);
        client.queryBuilder().sql(sql).run();
        client.alterSession(ExecConstants.ENABLE_ITERATOR_VALIDATION, false);
        client.queryBuilder().sql(sql).run();
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 62 with ClientFixture

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

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();
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 63 with ClientFixture

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

the class TestSimpleExternalSort method sortOneKeyDescendingExternalSort.

private void sortOneKeyDescendingExternalSort(boolean testLegacy) throws Throwable {
    FixtureBuilder builder = ClusterFixture.builder().configProperty(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD, 4).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE, 4);
    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(1000000, client.countResults(results));
        validateResults(client.allocator(), results);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) FixtureBuilder(org.apache.drill.test.FixtureBuilder) ClientFixture(org.apache.drill.test.ClientFixture)

Example 64 with ClientFixture

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

the class TestValidationOptions method testOptions.

// To validate these tests, set breakpoints in ImplCreator
// and IteratorValidatorBatchIterator to see if the options
// work as expected.
@Test
public void testOptions() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).maxParallelization(1).configProperty(ExecConstants.ENABLE_ITERATOR_VALIDATION, false).configProperty(ExecConstants.ENABLE_VECTOR_VALIDATION, false).sessionOption(ExecConstants.ENABLE_ITERATOR_VALIDATION_OPTION, true).sessionOption(ExecConstants.ENABLE_VECTOR_VALIDATION_OPTION, true);
    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();
        client.alterSession(ExecConstants.ENABLE_VECTOR_VALIDATION, false);
        client.queryBuilder().sql(sql).run();
        client.alterSession(ExecConstants.ENABLE_ITERATOR_VALIDATION, false);
        client.queryBuilder().sql(sql).run();
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 65 with ClientFixture

use of org.apache.drill.test.ClientFixture 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);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder)

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