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) -
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.Returntable definitioncorresponding to this iceberg tabledefinition(@NotNull IcebergReadInstructions readInstructions) Returntable definitioncorresponding to this iceberg tableReturntablecontaining thedefinitionof this Iceberg table.definitionTable(IcebergReadInstructions readInstructions) Returntablecontaining thedefinitionof this Iceberg table.@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.voidrefresh()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 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 Deephaventable.table(@NotNull IcebergReadInstructions readInstructions) Read a snapshot of this Iceberg table from the Iceberg catalog as a Deephaventable.org.apache.iceberg.catalog.TableIdentifierGet the Icebergtable identifier.tableWriter(TableWriterOptions tableWriterOptions) Create a newIcebergTableWriterfor 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()Catalogused 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 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
Returntable definitioncorresponding to this iceberg table- Returns:
- The table definition
-
definition
Returntable definitioncorresponding to this iceberg table- Parameters:
readInstructions- The instructions for customizations while reading the table.- Returns:
- The table definition
-
definitionTable
Returntablecontaining thedefinitionof this Iceberg table.- Returns:
- The table definition as a Deephaven table
-
definitionTable
Returntablecontaining thedefinitionof 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 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.
-