Package io.deephaven.iceberg.util
Class IcebergTableAdapter
java.lang.Object
io.deephaven.iceberg.util.IcebergTableAdapter
This class manages an Iceberg
table and provides methods to interact with it.-
Constructor Summary
ConstructorsConstructorDescriptionIcebergTableAdapter(org.apache.iceberg.catalog.Catalog catalog, org.apache.iceberg.catalog.TableIdentifier tableIdentifier, org.apache.iceberg.Table table, DataInstructionsProviderLoader dataInstructionsProviderLoader, Resolver resolver, org.apache.iceberg.mapping.NameMapping nameMapping) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.iceberg.catalog.Catalogcatalog()Catalogused to access this table.org.apache.iceberg.SchemaRetrieve the currentschemaof an Iceberg table.org.apache.iceberg.SnapshotGet the currentsnapshotof a given Iceberg table ornullif there are no snapshots.TheTable definitionfor this Iceberg table.definition(@NotNull IcebergReadInstructions readInstructions) Deprecated.Themetadata Tablefor this Iceberg table.definitionTable(IcebergReadInstructions readInstructions) Deprecated.@Nullable org.apache.iceberg.SnapshotgetSnapshot(@NotNull IcebergReadInstructions readInstructions) Retrieves the appropriateSnapshotbased on the providedIcebergReadInstructions, ornullif nosnapshotorsnapshotIdis provided.org.apache.iceberg.TableReturn the underlying Iceberg table.List<org.apache.iceberg.Snapshot> Get the current list of allsnapshotsof the Iceberg table.Get the location URI of the Iceberg table.org.apache.iceberg.mapping.NameMappingThe name mapping.provider(@NotNull TableKey tableKey, @NotNull IcebergReadInstructions readInstructions) voidrefresh()Refresh the table with the latest information from the Iceberg catalog, including new snapshots and schema.resolver()The resolver.Optional<org.apache.iceberg.Schema> schema(int schemaId) Retrieve a specificschemaof an Iceberg table.schemas()Retrieve the currentschemaof an Iceberg table.List allsnapshotsof a given Iceberg table as a Deephaventable.table()Read the latest snapshot of this Iceberg table from the Iceberg catalog as a Deephaventableusingdefault read instructions.table(@NotNull TableKey tableKey, @NotNull IcebergReadInstructions readInstructions) table(@NotNull IcebergReadInstructions readInstructions) Read this Iceberg table from the Iceberg catalog as a DeephaventableusingreadInstructions.org.apache.iceberg.catalog.TableIdentifierGet the Icebergtable identifier.tableWriter(TableWriterOptions tableWriterOptions) Create a newIcebergTableWriterfor this Iceberg table using the providedTableWriterOptions.toString()
-
Constructor Details
-
IcebergTableAdapter
@InternalUseOnly public IcebergTableAdapter(org.apache.iceberg.catalog.Catalog catalog, org.apache.iceberg.catalog.TableIdentifier tableIdentifier, org.apache.iceberg.Table table, DataInstructionsProviderLoader dataInstructionsProviderLoader, Resolver resolver, org.apache.iceberg.mapping.NameMapping nameMapping)
-
-
Method Details
-
catalog
public org.apache.iceberg.catalog.Catalog catalog()Catalogused to access this table. -
tableIdentifier
public org.apache.iceberg.catalog.TableIdentifier tableIdentifier()Get the Icebergtable identifier. -
resolver
The resolver. -
nameMapping
public org.apache.iceberg.mapping.NameMapping nameMapping()The name mapping. -
currentSnapshot
public org.apache.iceberg.Snapshot currentSnapshot()Get the currentsnapshotof a given Iceberg table ornullif there are no snapshots.- Returns:
- The current snapshot of the table or
nullif there are no snapshots.
-
listSnapshots
Get the current list of allsnapshotsof the Iceberg table.- Returns:
- A list of all snapshots of the given table.
-
snapshots
List allsnapshotsof a given Iceberg table as a Deephaventable. The resulting table will be static and contain the following columns:Column Name Description Id The snapshot identifier (can be used for updating the table or loading a specific snapshot) Timestamp The timestamp of the snapshot Operation The data operation that created this snapshot Summary Additional information about the snapshot from the Iceberg metadata SnapshotObject A Java object containing the Iceberg API snapshot - Returns:
- A Table containing a list of all tables in the given namespace.
-
currentSchema
public org.apache.iceberg.Schema currentSchema()Retrieve the currentschemaof an Iceberg table. -
schemas
Retrieve the currentschemaof an Iceberg table. -
schema
Retrieve a specificschemaof an Iceberg table.- Parameters:
schemaId- The identifier of the schema to load.
-
getSnapshot
@InternalUseOnly @Nullable public @Nullable org.apache.iceberg.Snapshot getSnapshot(@NotNull @NotNull IcebergReadInstructions readInstructions) Retrieves the appropriateSnapshotbased on the providedIcebergReadInstructions, ornullif nosnapshotorsnapshotIdis provided. -
definition
TheTable definitionfor this Iceberg table.- Returns:
- The table definition
-
definition
@Deprecated public TableDefinition definition(@NotNull @NotNull IcebergReadInstructions readInstructions) Deprecated.usedefinition()TheTable definitionfor this Iceberg table.- Parameters:
readInstructions- The instructions for customizations while reading the table.- Returns:
- The table definition
-
definitionTable
Themetadata Tablefor this Iceberg table.- Returns:
- The table definition as a Deephaven table
- See Also:
-
definitionTable
Deprecated.Themetadata Tablefor this Iceberg table.- Parameters:
readInstructions- The instructions for customizations while reading the table.- Returns:
- The table definition as a Deephaven table
-
table
Read the latest snapshot of this Iceberg table from the Iceberg catalog as a Deephaventableusingdefault read instructions.Equivalent to
table(IcebergReadInstructions.DEFAULT).- Returns:
- The loaded table
- See Also:
-
table
Read this Iceberg table from the Iceberg catalog as a DeephaventableusingreadInstructions.- Parameters:
readInstructions- The instructions for customizations while reading the table.- Returns:
- The loaded table
-
refresh
public void refresh()Refresh the table with the latest information from the Iceberg catalog, including new snapshots and schema. -
icebergTable
public org.apache.iceberg.Table icebergTable()Return the underlying Iceberg table. -
toString
-
tableWriter
Create a newIcebergTableWriterfor this Iceberg table using the providedTableWriterOptions.This method will perform schema validation to ensure that the provided
TableWriterOptions.tableDefinition()is compatible with the Iceberg table schema. All further writes performed by the returned writer will not be validated against the table's schema, and thus will be faster.- Parameters:
tableWriterOptions- The options to configure the table writer.- Returns:
- A new instance of
IcebergTableWriterconfigured with the provided options.
-
locationUri
Get the location URI of the Iceberg table. -
table
@InternalUseOnly public IcebergTable table(@NotNull @NotNull TableKey tableKey, @NotNull @NotNull IcebergReadInstructions readInstructions) -
provider
@InternalUseOnly public IcebergTableLocationProviderBase<TableKey,IcebergTableLocationKey> provider(@NotNull @NotNull TableKey tableKey, @NotNull @NotNull IcebergReadInstructions readInstructions)
-
definition()