Search in sources :

Example 16 with ClusterFixtureBuilder

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

the class ParquetInternalsTest method setup.

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

Example 17 with ClusterFixtureBuilder

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

Example 18 with ClusterFixtureBuilder

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

the class TestSimpleExternalSort method sortOneKeyDescendingMergeSort.

@Test
public void sortOneKeyDescendingMergeSort() throws Throwable {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        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) Test(org.junit.Test) SlowTest(org.apache.drill.categories.SlowTest) DrillTest(org.apache.drill.test.DrillTest)

Example 19 with ClusterFixtureBuilder

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

the class TestSimpleExternalSort method outOfMemoryExternalSort.

@Test
public void outOfMemoryExternalSort() throws Throwable {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty("drill.memory.fragment.max", 50_000_000).configProperty("drill.memory.fragment.initial", 2_000_000).configProperty("drill.memory.operator.max", 30_000_000).configProperty("drill.memory.operator.initial", 2_000_000);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        List<QueryDataBatch> results = client.queryBuilder().physicalResource("/xsort/oom_sort_test.json").results();
        assertEquals(10_000_000, client.countResults(results));
        long previousBigInt = Long.MAX_VALUE;
        for (QueryDataBatch b : results) {
            RecordBatchLoader loader = new RecordBatchLoader(client.allocator());
            if (b.getHeader().getRowCount() > 0) {
                loader.load(b.getHeader().getDef(), b.getData());
                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++) {
                    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();
        }
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) SchemaPath(org.apache.drill.common.expression.SchemaPath) RecordBatchLoader(org.apache.drill.exec.record.RecordBatchLoader) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) BigIntVector(org.apache.drill.exec.vector.BigIntVector) Test(org.junit.Test) SlowTest(org.apache.drill.categories.SlowTest) DrillTest(org.apache.drill.test.DrillTest)

Example 20 with ClusterFixtureBuilder

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

the class TestSortSpillWithException method setup.

@BeforeClass
public static void setup() throws Exception {
    dirTestWatcher.copyResourceToRoot(Paths.get("xsort"));
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD, // Unmanaged
    1).configProperty(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE, // Unmanaged
    1).configProperty(ExecConstants.EXTERNAL_SORT_MAX_MEMORY, 10 * 1024 * 1024).sessionOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, // Spill early
    60 * 1024 * 1024).sessionOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.0).maxParallelization(1);
    startCluster(builder);
}
Also used : ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) BeforeClass(org.junit.BeforeClass)

Aggregations

ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)156 ClusterFixture (org.apache.drill.test.ClusterFixture)102 Test (org.junit.Test)93 ClientFixture (org.apache.drill.test.ClientFixture)89 BeforeClass (org.junit.BeforeClass)47 SlowTest (org.apache.drill.categories.SlowTest)44 OptionsTest (org.apache.drill.categories.OptionsTest)34 BaseTest (org.apache.drill.test.BaseTest)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 DrillTest (org.apache.drill.test.DrillTest)14 OperatorTest (org.apache.drill.categories.OperatorTest)8 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)8 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)6 StoragePluginConfig (org.apache.drill.common.logical.StoragePluginConfig)5 PluginException (org.apache.drill.exec.store.StoragePluginRegistry.PluginException)5 File (java.io.File)4 ResourceManagerTest (org.apache.drill.categories.ResourceManagerTest)4 DefaultResourceManager (org.apache.drill.exec.work.foreman.rm.DefaultResourceManager)4 DistributedResourceManager (org.apache.drill.exec.work.foreman.rm.DistributedResourceManager)4 ResourceManager (org.apache.drill.exec.work.foreman.rm.ResourceManager)4