use of com.facebook.presto.common.QualifiedObjectName in project presto by prestodb.
the class TestHiveIntegrationSmokeTest method getHiveTableProperty.
private Object getHiveTableProperty(String tableName, Function<HiveTableLayoutHandle, Object> propertyGetter) {
Session session = getSession();
Metadata metadata = ((DistributedQueryRunner) getQueryRunner()).getCoordinator().getMetadata();
return transaction(getQueryRunner().getTransactionManager(), getQueryRunner().getAccessControl()).readOnly().execute(session, transactionSession -> {
Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, new QualifiedObjectName(catalog, TPCH_SCHEMA, tableName));
assertTrue(tableHandle.isPresent());
TableLayout layout = metadata.getLayout(transactionSession, tableHandle.get(), Constraint.alwaysTrue(), Optional.empty()).getLayout();
return propertyGetter.apply((HiveTableLayoutHandle) layout.getNewTableHandle().getLayout().get());
});
}
use of com.facebook.presto.common.QualifiedObjectName 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.common.QualifiedObjectName 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;
});
}
use of com.facebook.presto.common.QualifiedObjectName in project presto by prestodb.
the class RedisQueryRunner method loadTpchTable.
private static void loadTpchTable(EmbeddedRedis embeddedRedis, TestingPrestoClient prestoClient, TpchTable<?> table, String dataFormat) {
long start = System.nanoTime();
log.info("Running import for %s", table.getTableName());
RedisTestUtils.loadTpchTable(embeddedRedis, prestoClient, redisTableName(table), new QualifiedObjectName("tpch", TINY_SCHEMA_NAME, table.getTableName().toLowerCase(ENGLISH)), dataFormat);
log.info("Imported %s in %s", table.getTableName(), nanosSince(start).convertToMostSuccinctTimeUnit());
}
Aggregations