use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.
the class PhoenixBaseTest method startDrillCluster.
public static void startDrillCluster() throws Exception {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
startCluster(builder);
Map<String, Object> props = Maps.newHashMap();
props.put("phoenix.query.timeoutMs", 90000);
props.put("phoenix.query.keepAliveMs", "30000");
StoragePluginRegistry registry = cluster.drillbit().getContext().getStorage();
PhoenixStoragePluginConfig config = new PhoenixStoragePluginConfig(null, 0, null, null, QueryServerBasicsIT.CONN_STRING, null, props);
config.setEnabled(true);
registry.put(PhoenixStoragePluginConfig.NAME + "123", config);
dirTestWatcher.copyResourceToRoot(Paths.get(""));
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.
the class TestSemiJoin method testInClauseWithSemiJoinDisabled.
@Test
public void testInClauseWithSemiJoinDisabled() throws Exception {
String sql = "select employee_id, full_name from cp.`employee.json` where employee_id in (select employee_id from cp.`employee.json` )";
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).setOptionDefault(PlannerSettings.SEMIJOIN.getOptionName(), false);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String queryPlan = client.queryBuilder().sql(sql).explainText();
assertTrue(!queryPlan.contains("semi-join: =[true]"));
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.
the class TestSemiJoin method testMultiColumnInClauseWithSemiJoin.
@Test
public void testMultiColumnInClauseWithSemiJoin() throws Exception {
String sql = "select * from cp.`employee.json` where (employee_id, full_name) in (select employee_id, full_name from cp.`employee.json` )";
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).setOptionDefault(PlannerSettings.SEMIJOIN.getOptionName(), true);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
String queryPlan = client.queryBuilder().sql(sql).explainText();
assertTrue(queryPlan.contains("semi-join: =[true]"));
}
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.
the class TestE2EUnnestAndLateral method setupTestFiles.
@BeforeClass
public static void setupTestFiles() throws Exception {
dirTestWatcher.copyResourceToRoot(Paths.get("lateraljoin", "multipleFiles", regularTestFile_1));
dirTestWatcher.copyResourceToRoot(Paths.get("lateraljoin", "multipleFiles", regularTestFile_2));
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).sessionOption(PlannerSettings.ENABLE_UNNEST_LATERAL_KEY, true).maxParallelization(1);
startCluster(builder);
}
use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.
the class TestLateralPlans method testUnnestWithAggInSubquery.
@Test
public void testUnnestWithAggInSubquery() throws Exception {
String sql = "select t.c_name, sum(t4.items) from cp.`lateraljoin/nested-customer.parquet` t," + " lateral (select t2.ord.items as items from unnest(t.orders) t2(ord)) d1," + " lateral (select sum(t3.items.i_number) from unnest(d1.items) t3(items)) t4(items) where t.c_id > 1 group by t.c_name";
String baselineQuery = "select t.c_name, sum(t3.items.i_number) from cp.`lateraljoin/nested-customer.parquet` t " + " inner join (select c_name, f, flatten(t1.f.items) from (select c_name, flatten(orders) as f from cp.`lateraljoin/nested-customer.parquet`) as t1 ) " + "t3(name, orders, items) on t.c_name = t3.name where t.c_id > 1 group by t.c_name";
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).setOptionDefault(PlannerSettings.ENABLE_UNNEST_LATERAL_KEY, true);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
client.testBuilder().ordered().sqlBaselineQuery(baselineQuery).sqlQuery(sql).go();
}
}
Aggregations