use of com.facebook.presto.metadata.Metadata in project presto by prestodb.
the class TestHiveIntegrationSmokeTest method getHiveInsertTableHandle.
private HiveInsertTableHandle getHiveInsertTableHandle(Session session, String tableName) {
Metadata metadata = ((DistributedQueryRunner) getQueryRunner()).getCoordinator().getMetadata();
return transaction(getQueryRunner().getTransactionManager(), getQueryRunner().getAccessControl()).execute(session, transactionSession -> {
QualifiedObjectName objectName = new QualifiedObjectName(catalog, TPCH_SCHEMA, tableName);
Optional<TableHandle> handle = metadata.getTableHandle(transactionSession, objectName);
InsertTableHandle insertTableHandle = metadata.beginInsert(transactionSession, handle.get());
HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle.getConnectorHandle();
metadata.finishInsert(transactionSession, insertTableHandle, ImmutableList.of(), ImmutableList.of());
return hiveInsertTableHandle;
});
}
use of com.facebook.presto.metadata.Metadata in project presto by prestodb.
the class AbstractTestQueryFramework method getQueryExplainer.
private QueryExplainer getQueryExplainer() {
Metadata metadata = queryRunner.getMetadata();
FeaturesConfig featuresConfig = new FeaturesConfig().setOptimizeHashGeneration(true);
boolean forceSingleNode = queryRunner.getNodeCount() == 1;
TaskCountEstimator taskCountEstimator = new TaskCountEstimator(queryRunner::getNodeCount);
CostCalculator costCalculator = new CostCalculatorUsingExchanges(taskCountEstimator);
List<PlanOptimizer> optimizers = new PlanOptimizers(metadata, sqlParser, forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPlanOptimizerManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator, new PartitioningProviderManager()).getPlanningTimeOptimizers();
return new QueryExplainer(optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig(), sqlParser, new FeaturesConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of(), new PlanChecker(new FeaturesConfig(), false));
}
use of com.facebook.presto.metadata.Metadata in project presto by prestodb.
the class OrcTestingUtil method createRecordReader.
public static OrcBatchRecordReader createRecordReader(OrcReader orcReader, Map<Integer, Type> includedColumns) throws OrcCorruptionException {
Metadata metadata = MetadataManager.createTestMetadataManager();
FunctionAndTypeManager functionAndTypeManager = metadata.getFunctionAndTypeManager();
StorageTypeConverter storageTypeConverter = new StorageTypeConverter(functionAndTypeManager);
return orcReader.createBatchRecordReader(storageTypeConverter.toStorageTypes(includedColumns), OrcPredicate.TRUE, DateTimeZone.UTC, new RaptorOrcAggregatedMemoryContext(), MAX_BATCH_SIZE);
}
use of com.facebook.presto.metadata.Metadata in project presto by prestodb.
the class TestPrestoSparkLauncherIntegrationSmokeTest method dropTable.
private void dropTable(String table) {
// LocalQueryRunner doesn't support DROP TABLE
localQueryRunner.inTransaction(localQueryRunner.getDefaultSession(), transactionSession -> {
Metadata metadata = localQueryRunner.getMetadata();
TableHandle tableHandle = metadata.getTableHandle(transactionSession, new QualifiedObjectName("hive", "default", table)).get();
metadata.dropTable(transactionSession, tableHandle);
return null;
});
}
Aggregations