Search in sources :

Example 1 with IcebergTableOperationsProvider

use of io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider in project trino by trinodb.

the class TestIcebergSplitSource method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    HdfsConfig config = new HdfsConfig();
    HdfsConfiguration configuration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(configuration, config, new NoHdfsAuthentication());
    File tempDir = Files.createTempDirectory("test_iceberg_split_source").toFile();
    this.metastoreDir = new File(tempDir, "iceberg_data");
    HiveMetastore metastore = createTestingFileHiveMetastore(metastoreDir);
    IcebergTableOperationsProvider operationsProvider = new FileMetastoreTableOperationsProvider(new HdfsFileIoProvider(hdfsEnvironment));
    this.catalog = new TrinoHiveCatalog(new CatalogName("hive"), memoizeMetastore(metastore, 1000), hdfsEnvironment, new TestingTypeManager(), operationsProvider, "test", false, false, false);
    return createIcebergQueryRunner(ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(NATION), Optional.of(metastoreDir));
}
Also used : HdfsConfigurationInitializer(io.trino.plugin.hive.HdfsConfigurationInitializer) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) HiveMetastore(io.trino.plugin.hive.metastore.HiveMetastore) FileHiveMetastore.createTestingFileHiveMetastore(io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore) HdfsConfig(io.trino.plugin.hive.HdfsConfig) HiveHdfsConfiguration(io.trino.plugin.hive.HiveHdfsConfiguration) HdfsConfiguration(io.trino.plugin.hive.HdfsConfiguration) NoHdfsAuthentication(io.trino.plugin.hive.authentication.NoHdfsAuthentication) HdfsEnvironment(io.trino.plugin.hive.HdfsEnvironment) FileMetastoreTableOperationsProvider(io.trino.plugin.iceberg.catalog.file.FileMetastoreTableOperationsProvider) TrinoHiveCatalog(io.trino.plugin.iceberg.catalog.hms.TrinoHiveCatalog) CatalogName(io.trino.plugin.base.CatalogName) IcebergTableOperationsProvider(io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider) File(java.io.File) TestingTypeManager(io.trino.spi.type.TestingTypeManager)

Example 2 with IcebergTableOperationsProvider

use of io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider in project trino by trinodb.

the class TestIcebergV2 method updateTableToV2.

private Table updateTableToV2(String tableName) {
    IcebergTableOperationsProvider tableOperationsProvider = new FileMetastoreTableOperationsProvider(new HdfsFileIoProvider(hdfsEnvironment));
    TrinoCatalog catalog = new TrinoHiveCatalog(new CatalogName("hive"), CachingHiveMetastore.memoizeMetastore(metastore, 1000), hdfsEnvironment, new TestingTypeManager(), tableOperationsProvider, "test", false, false, false);
    BaseTable table = (BaseTable) loadIcebergTable(catalog, tableOperationsProvider, SESSION, new SchemaTableName("tpch", tableName));
    TableOperations operations = table.operations();
    TableMetadata currentMetadata = operations.current();
    operations.commit(currentMetadata, currentMetadata.upgradeToFormatVersion(2));
    return table;
}
Also used : TableMetadata(org.apache.iceberg.TableMetadata) BaseTable(org.apache.iceberg.BaseTable) TableOperations(org.apache.iceberg.TableOperations) FileMetastoreTableOperationsProvider(io.trino.plugin.iceberg.catalog.file.FileMetastoreTableOperationsProvider) TrinoHiveCatalog(io.trino.plugin.iceberg.catalog.hms.TrinoHiveCatalog) CatalogName(io.trino.plugin.base.CatalogName) IcebergTableOperationsProvider(io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider) SchemaTableName(io.trino.spi.connector.SchemaTableName) TrinoCatalog(io.trino.plugin.iceberg.catalog.TrinoCatalog) TestingTypeManager(io.trino.spi.type.TestingTypeManager)

Aggregations

CatalogName (io.trino.plugin.base.CatalogName)2 IcebergTableOperationsProvider (io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider)2 FileMetastoreTableOperationsProvider (io.trino.plugin.iceberg.catalog.file.FileMetastoreTableOperationsProvider)2 TrinoHiveCatalog (io.trino.plugin.iceberg.catalog.hms.TrinoHiveCatalog)2 TestingTypeManager (io.trino.spi.type.TestingTypeManager)2 HdfsConfig (io.trino.plugin.hive.HdfsConfig)1 HdfsConfiguration (io.trino.plugin.hive.HdfsConfiguration)1 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)1 HdfsEnvironment (io.trino.plugin.hive.HdfsEnvironment)1 HiveHdfsConfiguration (io.trino.plugin.hive.HiveHdfsConfiguration)1 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)1 HiveMetastore (io.trino.plugin.hive.metastore.HiveMetastore)1 FileHiveMetastore.createTestingFileHiveMetastore (io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore)1 TrinoCatalog (io.trino.plugin.iceberg.catalog.TrinoCatalog)1 SchemaTableName (io.trino.spi.connector.SchemaTableName)1 File (java.io.File)1 BaseTable (org.apache.iceberg.BaseTable)1 TableMetadata (org.apache.iceberg.TableMetadata)1 TableOperations (org.apache.iceberg.TableOperations)1