Class IcebergTableAdapter

java.lang.Object
io.deephaven.iceberg.util.IcebergTableAdapter

public class IcebergTableAdapter extends Object
This class manages an Iceberg table and provides methods to interact with it.
  • 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 Iceberg table identifier.
    • currentSnapshot

      public org.apache.iceberg.Snapshot currentSnapshot()
      Get the current snapshot of a given Iceberg table or null if there are no snapshots.
      Returns:
      The current snapshot of the table or null if there are no snapshots.
    • listSnapshots

      public List<org.apache.iceberg.Snapshot> listSnapshots()
      Get the current list of all snapshots of the Iceberg table.
      Returns:
      A list of all snapshots of the given table.
    • snapshots

      public Table snapshots()
      List all snapshots of a given Iceberg table as a Deephaven table. 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 current schema of an Iceberg table.
    • schemas

      public Map<Integer,org.apache.iceberg.Schema> schemas()
      Retrieve the current schema of an Iceberg table.
    • schema

      public Optional<org.apache.iceberg.Schema> schema(int schemaId)
      Retrieve a specific schema 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 appropriate Snapshot based on the provided IcebergReadInstructions, or null if no snapshot or snapshotId is provided.
    • definition

      public TableDefinition definition()
      Return table definition corresponding to this iceberg table
      Returns:
      The table definition
    • definition

      public TableDefinition definition(@NotNull @NotNull IcebergReadInstructions readInstructions)
      Return table definition corresponding to this iceberg table
      Parameters:
      readInstructions - The instructions for customizations while reading the table.
      Returns:
      The table definition
    • definitionTable

      public Table definitionTable()
      Return table containing the definition of this Iceberg table.
      Returns:
      The table definition as a Deephaven table
    • definitionTable

      public Table definitionTable(IcebergReadInstructions readInstructions)
      Return table containing the definition of this Iceberg table.
      Parameters:
      readInstructions - The instructions for customizations while reading the table.
      Returns:
      The table definition as a Deephaven table
    • table

      public IcebergTable table()
      Read the latest snapshot of this Iceberg table from the Iceberg catalog as a Deephaven table.
      Returns:
      The loaded table
    • table

      public IcebergTable table(@NotNull @NotNull IcebergReadInstructions readInstructions)
      Read a snapshot of this Iceberg table from the Iceberg catalog as a Deephaven table.
      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

      public String toString()
      Overrides:
      toString in class Object
    • tableWriter

      public IcebergTableWriter tableWriter(TableWriterOptions tableWriterOptions)
      Create a new IcebergTableWriter for this Iceberg table using the provided TableWriterOptions.

      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.