Class TableImpl

Object
io.delta.kernel.internal.TableImpl
All Implemented Interfaces:
Table

public class TableImpl extends Object implements Table
  • Constructor Details

    • TableImpl

      public TableImpl(String tablePath)
  • Method Details

    • forPath

      public static Table forPath(Engine engine, String path)
      Description copied from interface: Table
      Instantiate a table object for the Delta Lake table at the given path.
      • Behavior when the table location doesn't exist:
      • Behavior when the table location exists (with contents or not) but not a Delta table:
        • Reads will fail with a TableNotFoundException
        • Writes will create a Delta table at the given location. If there are any existing files in the location that are not already part of the Delta table, they will remain excluded from the Delta table.
      Parameters:
      engine - Engine instance to use in Delta Kernel.
      path - location of the table. Path is resolved to fully qualified path using the given engine.
      Returns:
      an instance of Table representing the Delta table at the given path
    • getPath

      public String getPath(Engine engine)
      Description copied from interface: Table
      The fully qualified path of this Table instance.
      Specified by:
      getPath in interface Table
      Parameters:
      engine - Engine instance.
      Returns:
      the table path.
    • getLatestSnapshot

      public Snapshot getLatestSnapshot(Engine engine) throws TableNotFoundException
      Description copied from interface: Table
      Get the latest snapshot of the table.
      Specified by:
      getLatestSnapshot in interface Table
      Parameters:
      engine - Engine instance to use in Delta Kernel.
      Returns:
      an instance of Snapshot
      Throws:
      TableNotFoundException - if the table is not found
    • getSnapshotAsOfVersion

      public Snapshot getSnapshotAsOfVersion(Engine engine, long versionId) throws TableNotFoundException
      Description copied from interface: Table
      Get the snapshot at the given versionId.
      Specified by:
      getSnapshotAsOfVersion in interface Table
      Parameters:
      engine - Engine instance to use in Delta Kernel.
      versionId - snapshot version to retrieve
      Returns:
      an instance of Snapshot
      Throws:
      TableNotFoundException - if the table is not found
    • getSnapshotAsOfTimestamp

      public Snapshot getSnapshotAsOfTimestamp(Engine engine, long millisSinceEpochUTC) throws TableNotFoundException
      Description copied from interface: Table
      Get the snapshot of the table at the given timestamp. This is the latest version of the table that was committed before or at timestamp.

      Specifically:

      • If a commit version exactly matches the provided timestamp, we return the table snapshot at that version.
      • Else, we return the latest commit version with a timestamp less than the provided one.
      • If the provided timestamp is less than the timestamp of any committed version, we throw an error.
      • If the provided timestamp is after (strictly greater than) the timestamp of the latest version of the table, we throw an error
      .
      Specified by:
      getSnapshotAsOfTimestamp in interface Table
      Parameters:
      engine - Engine instance to use in Delta Kernel.
      millisSinceEpochUTC - timestamp to fetch the snapshot for in milliseconds since the unix epoch
      Returns:
      an instance of Snapshot
      Throws:
      TableNotFoundException - if the table is not found
    • checkpoint

      public void checkpoint(Engine engine, long version) throws TableNotFoundException, CheckpointAlreadyExistsException, IOException
      Description copied from interface: Table
      Checkpoint the table at given version. It writes a single checkpoint file.
      Specified by:
      checkpoint in interface Table
      Parameters:
      engine - Engine instance to use.
      version - Version to checkpoint.
      Throws:
      TableNotFoundException - if the table is not found
      CheckpointAlreadyExistsException - if a checkpoint already exists at the given version
      IOException - for any I/O error.
    • createTransactionBuilder

      public TransactionBuilder createTransactionBuilder(Engine engine, String engineInfo, Operation operation)
      Description copied from interface: Table
      Create a TransactionBuilder which can create a Transaction object to mutate the table.
      Specified by:
      createTransactionBuilder in interface Table
      Parameters:
      engine - Engine instance to use.
      engineInfo - information about the engine that is making the updates.
      operation - metadata of operation that is being performed. E.g. "insert", "delete".
      Returns:
      TransactionBuilder instance to build the transaction.