Search in sources :

Example 1 with StaticTableOperations

use of org.apache.iceberg.StaticTableOperations in project iceberg by apache.

the class BaseSparkAction method newStaticTable.

protected Table newStaticTable(TableMetadata metadata, FileIO io) {
    String metadataFileLocation = metadata.metadataFileLocation();
    StaticTableOperations ops = new StaticTableOperations(metadataFileLocation, io);
    return new BaseTable(ops, metadataFileLocation);
}
Also used : BaseTable(org.apache.iceberg.BaseTable) StaticTableOperations(org.apache.iceberg.StaticTableOperations)

Example 2 with StaticTableOperations

use of org.apache.iceberg.StaticTableOperations in project iceberg by apache.

the class TestStaticTable method testLoadFromMetadata.

@Test
public void testLoadFromMetadata() {
    Table staticTable = getStaticTable();
    Assert.assertTrue("Loading a metadata file based table should return StaticTableOperations", ((HasTableOperations) staticTable).operations() instanceof StaticTableOperations);
}
Also used : Table(org.apache.iceberg.Table) StaticTableOperations(org.apache.iceberg.StaticTableOperations) HasTableOperations(org.apache.iceberg.HasTableOperations) Test(org.junit.Test)

Example 3 with StaticTableOperations

use of org.apache.iceberg.StaticTableOperations in project iceberg by apache.

the class TestReachableFileUtil method testVersionHintWithStaticTables.

@Test
public void testVersionHintWithStaticTables() {
    TableOperations ops = ((HasTableOperations) table).operations();
    TableMetadata metadata = ops.current();
    String metadataFileLocation = metadata.metadataFileLocation();
    StaticTableOperations staticOps = new StaticTableOperations(metadataFileLocation, table.io());
    Table staticTable = new BaseTable(staticOps, metadataFileLocation);
    String reportedVersionHintLocation = ReachableFileUtil.versionHintLocation(staticTable);
    String expectedVersionHintLocation = ops.metadataFileLocation(Util.VERSION_HINT_FILENAME);
    Assert.assertEquals(expectedVersionHintLocation, reportedVersionHintLocation);
}
Also used : TableMetadata(org.apache.iceberg.TableMetadata) BaseTable(org.apache.iceberg.BaseTable) Table(org.apache.iceberg.Table) StaticTableOperations(org.apache.iceberg.StaticTableOperations) TableOperations(org.apache.iceberg.TableOperations) HasTableOperations(org.apache.iceberg.HasTableOperations) BaseTable(org.apache.iceberg.BaseTable) StaticTableOperations(org.apache.iceberg.StaticTableOperations) HasTableOperations(org.apache.iceberg.HasTableOperations) Test(org.junit.Test)

Aggregations

StaticTableOperations (org.apache.iceberg.StaticTableOperations)3 BaseTable (org.apache.iceberg.BaseTable)2 HasTableOperations (org.apache.iceberg.HasTableOperations)2 Table (org.apache.iceberg.Table)2 Test (org.junit.Test)2 TableMetadata (org.apache.iceberg.TableMetadata)1 TableOperations (org.apache.iceberg.TableOperations)1