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.Catalog
catalog()
Catalog
used to access this table.org.apache.iceberg.Schema
Retrieve the currentschema
of an Iceberg table.org.apache.iceberg.Snapshot
Get the currentsnapshot
of a given Iceberg table ornull
if there are no snapshots.TheTable definition
for this Iceberg table.definition
(@NotNull IcebergReadInstructions readInstructions) Deprecated.Themetadata Table
for this Iceberg table.definitionTable
(IcebergReadInstructions readInstructions) Deprecated.@Nullable org.apache.iceberg.Snapshot
getSnapshot
(@NotNull IcebergReadInstructions readInstructions) Retrieves the appropriateSnapshot
based on the providedIcebergReadInstructions
, ornull
if nosnapshot
orsnapshotId
is provided.org.apache.iceberg.Table
Return the underlying Iceberg table.List<org.apache.iceberg.Snapshot>
Get the current list of allsnapshots
of the Iceberg table.Get the location URI of the Iceberg table.provider
(@NotNull TableKey tableKey, @NotNull IcebergReadInstructions readInstructions) void
refresh()
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 specificschema
of an Iceberg table.schemas()
Retrieve the currentschema
of an Iceberg table.List allsnapshots
of a given Iceberg table as a Deephaventable
.table()
Read the latest snapshot of this Iceberg table from the Iceberg catalog as a Deephaventable
usingdefault read instructions
.table
(@NotNull TableKey tableKey, @NotNull IcebergReadInstructions readInstructions) table
(@NotNull IcebergReadInstructions readInstructions) Read this Iceberg table from the Iceberg catalog as a Deephaventable
usingreadInstructions
.org.apache.iceberg.catalog.TableIdentifier
Get the Icebergtable identifier
.tableWriter
(TableWriterOptions tableWriterOptions) Create a newIcebergTableWriter
for this Iceberg table using the providedTableWriterOptions
.toString()
-
Constructor Details
-
IcebergTableAdapter
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()Catalog
used to access this table. -
tableIdentifier
public org.apache.iceberg.catalog.TableIdentifier tableIdentifier()Get the Icebergtable identifier
. -
resolver
The resolver. -
currentSnapshot
public org.apache.iceberg.Snapshot currentSnapshot()Get the currentsnapshot
of a given Iceberg table ornull
if there are no snapshots.- Returns:
- The current snapshot of the table or
null
if there are no snapshots.
-
listSnapshots
Get the current list of allsnapshots
of the Iceberg table.- Returns:
- A list of all snapshots of the given table.
-
snapshots
List allsnapshots
of 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 currentschema
of an Iceberg table. -
schemas
Retrieve the currentschema
of an Iceberg table. -
schema
Retrieve a specificschema
of 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 appropriateSnapshot
based on the providedIcebergReadInstructions
, ornull
if nosnapshot
orsnapshotId
is provided. -
definition
TheTable definition
for this Iceberg table.- Returns:
- The table definition
-
definition
@Deprecated public TableDefinition definition(@NotNull @NotNull IcebergReadInstructions readInstructions) Deprecated.usedefinition()
TheTable definition
for this Iceberg table.- Parameters:
readInstructions
- The instructions for customizations while reading the table.- Returns:
- The table definition
-
definitionTable
Themetadata Table
for this Iceberg table.- Returns:
- The table definition as a Deephaven table
- See Also:
-
definitionTable
Deprecated.Themetadata Table
for 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 Deephaventable
usingdefault read instructions
.Equivalent to
table(IcebergReadInstructions.DEFAULT)
.- Returns:
- The loaded table
- See Also:
-
table
Read this Iceberg table from the Iceberg catalog as a Deephaventable
usingreadInstructions
.- 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 newIcebergTableWriter
for 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
IcebergTableWriter
configured 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()