use of io.prestosql.metadata.InsertTableHandle in project hetu-core by openlookeng.
the class TestHiveIntegrationSmokeTest method getHiveInsertTableHandle.
private HiveInsertTableHandle getHiveInsertTableHandle(Session session, String tableName) {
getQueryRunner().getMetadata().cleanupQuery(session);
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(), false);
HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle.getConnectorHandle();
metadata.finishInsert(transactionSession, insertTableHandle, ImmutableList.of(), ImmutableList.of());
return hiveInsertTableHandle;
});
}
use of io.prestosql.metadata.InsertTableHandle in project boostkit-bigdata by kunpengcompute.
the class TestHiveIntegrationSmokeTest method getHiveInsertTableHandle.
private HiveInsertTableHandle getHiveInsertTableHandle(Session session, String tableName) {
getQueryRunner().getMetadata().cleanupQuery(session);
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(), false);
HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle.getConnectorHandle();
metadata.finishInsert(transactionSession, insertTableHandle, ImmutableList.of(), ImmutableList.of());
return hiveInsertTableHandle;
});
}
Aggregations