Search in sources :

Example 1 with FixtureBuilder

use of org.apache.drill.test.FixtureBuilder 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 {
    FixtureBuilder builder = ClusterFixture.builder().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) FixtureBuilder(org.apache.drill.test.FixtureBuilder) ClientFixture(org.apache.drill.test.ClientFixture) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 2 with FixtureBuilder

use of org.apache.drill.test.FixtureBuilder 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 {
    FixtureBuilder builder = ClusterFixture.builder().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) FixtureBuilder(org.apache.drill.test.FixtureBuilder) ClientFixture(org.apache.drill.test.ClientFixture) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 3 with FixtureBuilder

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

the class TestSimpleExternalSort method outOfMemoryExternalSort.

private void outOfMemoryExternalSort(boolean testLegacy) throws Throwable {
    FixtureBuilder builder = ClusterFixture.builder().configProperty("drill.memory.fragment.max", 50000000).configProperty("drill.memory.fragment.initial", 2000000).configProperty("drill.memory.operator.max", 30000000).configProperty("drill.memory.operator.initial", 2000000);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        chooseImpl(client, testLegacy);
        List<QueryDataBatch> results = client.queryBuilder().physicalResource("/xsort/oom_sort_test.json").results();
        assertEquals(10000000, client.countResults(results));
        long previousBigInt = Long.MAX_VALUE;
        int recordCount = 0;
        int batchCount = 0;
        for (QueryDataBatch b : results) {
            RecordBatchLoader loader = new RecordBatchLoader(client.allocator());
            if (b.getHeader().getRowCount() > 0) {
                batchCount++;
                loader.load(b.getHeader().getDef(), b.getData());
                @SuppressWarnings("resource") BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
                BigIntVector.Accessor a1 = c1.getAccessor();
                for (int i = 0; i < c1.getAccessor().getValueCount(); i++) {
                    recordCount++;
                    assertTrue(String.format("%d < %d", previousBigInt, a1.get(i)), previousBigInt >= a1.get(i));
                    previousBigInt = a1.get(i);
                }
                assertTrue(String.format("%d == %d", a1.get(0), a1.get(a1.getValueCount() - 1)), a1.get(0) != a1.get(a1.getValueCount() - 1));
            }
            loader.clear();
            b.release();
        }
        System.out.println(String.format("Sorted %,d records in %d batches.", recordCount, batchCount));
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) FixtureBuilder(org.apache.drill.test.FixtureBuilder) SchemaPath(org.apache.drill.common.expression.SchemaPath) RecordBatchLoader(org.apache.drill.exec.record.RecordBatchLoader) ClientFixture(org.apache.drill.test.ClientFixture) BigIntVector(org.apache.drill.exec.vector.BigIntVector)

Example 4 with FixtureBuilder

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

the class ParquetInternalsTest method setup.

@BeforeClass
public static void setup() throws Exception {
    FixtureBuilder builder = ClusterFixture.builder();
    startCluster(builder);
}
Also used : FixtureBuilder(org.apache.drill.test.FixtureBuilder) BeforeClass(org.junit.BeforeClass)

Example 5 with FixtureBuilder

use of org.apache.drill.test.FixtureBuilder 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)

Aggregations

FixtureBuilder (org.apache.drill.test.FixtureBuilder)6 ClientFixture (org.apache.drill.test.ClientFixture)5 ClusterFixture (org.apache.drill.test.ClusterFixture)5 DrillTest (org.apache.drill.test.DrillTest)3 Test (org.junit.Test)3 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)2 SchemaPath (org.apache.drill.common.expression.SchemaPath)1 RecordBatchLoader (org.apache.drill.exec.record.RecordBatchLoader)1 BigIntVector (org.apache.drill.exec.vector.BigIntVector)1 BeforeClass (org.junit.BeforeClass)1