use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestHiveDistributedJoinQueriesWithDynamicFiltering method testJoinWithSelectiveBuildSide.
@Test
public void testJoinWithSelectiveBuildSide() {
Session session = Session.builder(getSession()).setSystemProperty(JOIN_DISTRIBUTION_TYPE, FeaturesConfig.JoinDistributionType.BROADCAST.name()).build();
DistributedQueryRunner runner = (DistributedQueryRunner) getQueryRunner();
ResultWithQueryId<MaterializedResult> result = runner.executeWithQueryId(session, "SELECT * FROM lineitem JOIN orders ON lineitem.orderkey = orders.orderkey AND orders.custkey = 1");
assertGreaterThan(result.getResult().getRowCount(), 0);
OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:lineitem");
// Probe side may be partially scanned, depending on the drivers' scheduling:
assertLessThanOrEqual(probeStats.getInputPositions(), countRows("lineitem"));
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestHiveDistributedJoinQueriesWithDynamicFiltering method searchScanFilterAndProjectOperatorStats.
private OperatorStats searchScanFilterAndProjectOperatorStats(QueryId queryId, String tableName) {
DistributedQueryRunner runner = (DistributedQueryRunner) getQueryRunner();
Plan plan = runner.getQueryPlan(queryId);
PlanNodeId nodeId = PlanNodeSearcher.searchFrom(plan.getRoot()).where(node -> {
if (!(node instanceof ProjectNode)) {
return false;
}
ProjectNode projectNode = (ProjectNode) node;
FilterNode filterNode = (FilterNode) projectNode.getSource();
TableScanNode tableScanNode = (TableScanNode) filterNode.getSource();
return tableName.equals(tableScanNode.getTable().getConnectorHandle().toString());
}).findOnlyElement().getId();
return runner.getCoordinator().getQueryManager().getFullQueryInfo(queryId).getQueryStats().getOperatorSummaries().stream().filter(summary -> nodeId.equals(summary.getPlanNodeId())).collect(MoreCollectors.onlyElement());
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class HetuTestServer method startServer.
public void startServer(String dbName, Map<String, String> properties) throws Exception {
queryRunner = new DistributedQueryRunner(createSession(), 4, hetuProperties);
this.dbName = dbName;
startServer(properties);
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class HetuTestServer method startServer.
public void startServer(Map<String, String> properties) throws Exception {
carbonProperties.putAll(properties);
logger.info("------------ Starting Presto Server -------------");
DistributedQueryRunner distributedQueryRunner = createQueryRunner(hetuProperties);
Connection connection = createJdbcConnection(dbName);
statement = (PrestoStatement) connection.createStatement();
logger.info("STARTED SERVER AT :" + distributedQueryRunner.getCoordinator().getBaseUrl());
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class HindexQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties, Map<String, String> metastoreProperties, Map<String, String> coordinatorProperties) throws Exception {
Session session = testSessionBuilder().setSource("test").setCatalog("hive").setSchema("test").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).setExtraProperties(extraProperties).setCoordinatorProperties(coordinatorProperties).build();
try {
File tempDir = Files.createTempDirectory("test-hive").toFile();
File hiveDir = new File(tempDir, "hive_data");
HiveMetastore metastore = createTestingFileHiveMetastore(hiveDir);
HiveIdentity identity = new HiveIdentity(SESSION);
metastore.createDatabase(identity, Database.builder().setDatabaseName("test").setOwnerName("public").setOwnerType(PrincipalType.ROLE).build());
queryRunner.installPlugin(new HetuFileSystemClientPlugin());
queryRunner.installPlugin(new HetuMetastorePlugin());
queryRunner.installPlugin(new HiveHadoop2Plugin());
queryRunner.installPlugin(new HeuristicIndexPlugin());
queryRunner.installPlugin(new HivePlugin("Hive", Optional.of(metastore)));
queryRunner.getServers().forEach(server -> {
try {
server.loadMetastore(metastoreProperties);
server.getHeuristicIndexerManager().buildIndexClient();
server.getHeuristicIndexerManager().initCache();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
Map<String, String> hiveProperties = ImmutableMap.<String, String>builder().put("hive.allow-drop-table", "true").build();
queryRunner.createCatalog("hive", "Hive", hiveProperties);
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
Aggregations