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
ConstructorDescriptionIcebergTableAdapter
(org.apache.iceberg.catalog.Catalog catalog, org.apache.iceberg.catalog.TableIdentifier tableIdentifier, org.apache.iceberg.Table table, DataInstructionsProviderLoader dataInstructionsProviderLoader) -
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.Returntable definition
corresponding to this iceberg tabledefinition
(@NotNull IcebergReadInstructions readInstructions) Returntable definition
corresponding to this iceberg tableReturntable
containing thedefinition
of this Iceberg table.definitionTable
(IcebergReadInstructions readInstructions) Returntable
containing thedefinition
of this Iceberg table.@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.void
refresh()
Refresh the table with the latest information from the Iceberg catalog, including new snapshots and schema.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
.table
(@NotNull IcebergReadInstructions readInstructions) Read a snapshot of this Iceberg table from the Iceberg catalog as a Deephaventable
.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)
-
-
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
. -
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
Returntable definition
corresponding to this iceberg table- Returns:
- The table definition
-
definition
Returntable definition
corresponding to this iceberg table- Parameters:
readInstructions
- The instructions for customizations while reading the table.- Returns:
- The table definition
-
definitionTable
Returntable
containing thedefinition
of this Iceberg table.- Returns:
- The table definition as a Deephaven table
-
definitionTable
Returntable
containing thedefinition
of 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
.- Returns:
- The loaded table
-
table
Read a snapshot of this Iceberg table from the Iceberg catalog as a Deephaventable
.- 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.
-