Search in sources :

Example 1 with InsertTableHandle

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;
    });
}
Also used : Metadata(io.prestosql.metadata.Metadata) TableMetadata(io.prestosql.metadata.TableMetadata) ColumnMetadata(io.prestosql.spi.connector.ColumnMetadata) InsertTableHandle(io.prestosql.metadata.InsertTableHandle) TableHandle(io.prestosql.spi.metadata.TableHandle) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) InsertTableHandle(io.prestosql.metadata.InsertTableHandle)

Example 2 with InsertTableHandle

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;
    });
}
Also used : Metadata(io.prestosql.metadata.Metadata) TableMetadata(io.prestosql.metadata.TableMetadata) ColumnMetadata(io.prestosql.spi.connector.ColumnMetadata) InsertTableHandle(io.prestosql.metadata.InsertTableHandle) TableHandle(io.prestosql.spi.metadata.TableHandle) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) InsertTableHandle(io.prestosql.metadata.InsertTableHandle)

Aggregations

InsertTableHandle (io.prestosql.metadata.InsertTableHandle)2 Metadata (io.prestosql.metadata.Metadata)2 TableMetadata (io.prestosql.metadata.TableMetadata)2 ColumnMetadata (io.prestosql.spi.connector.ColumnMetadata)2 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)2 TableHandle (io.prestosql.spi.metadata.TableHandle)2