Class CommitActionsImpl

Object
io.delta.kernel.internal.CommitActionsImpl
All Implemented Interfaces:
CommitActions, AutoCloseable

public class CommitActionsImpl extends Object implements CommitActions, AutoCloseable
Implementation of CommitActions.

This implementation owns the commit file and supports multiple calls to getActions(). The first call reuses initially-read data to avoid double I/O, while subsequent calls re-read the commit file for memory efficiency.

Resource Management:

  • Calling getActions() transfers resource ownership to the returned iterator.
  • Callers MUST close the returned iterator (preferably using try-with-resources) to release file handles and other resources.
  • If getActions() is never called, callers should explicitly call close() to release internal resources. Otherwise, resources will be released when the object is garbage collected.
  • Constructor Details

    • CommitActionsImpl

      public CommitActionsImpl(Engine engine, FileStatus commitFile, String tablePath, Set<DeltaLogActionUtils.DeltaAction> actionSet)
      Creates a CommitActions from a commit file.
      Parameters:
      engine - the engine for file I/O
      commitFile - the commit file to read
      tablePath - the table path for error messages
      actionSet - the set of actions to read from the commit file
  • Method Details

    • getVersion

      public long getVersion()
      Description copied from interface: CommitActions
      Returns the commit version number.
      Specified by:
      getVersion in interface CommitActions
      Returns:
      the version number of this commit
    • getTimestamp

      public long getTimestamp()
      Description copied from interface: CommitActions
      Returns the commit timestamp in milliseconds since Unix epoch.
      Specified by:
      getTimestamp in interface CommitActions
      Returns:
      the timestamp of this commit
    • getActions

      public CloseableIterator<ColumnarBatch> getActions()
      Description copied from interface: CommitActions
      Returns an iterator over the action batches for this commit.

      Each ColumnarBatch contains actions from this commit only.

      Note: All rows within all batches have the same version (returned by CommitActions.getVersion()).

      This method can be called multiple times, and each call returns a new iterator over the same set of batches. This supports use cases like two-pass processing (e.g., validation pass followed by processing pass).

      Callers are responsible for closing each iterator returned by this method. Each iterator must be closed after use to release underlying resources.

      Specified by:
      getActions in interface CommitActions
      Returns:
      a CloseableIterator over columnar batches containing this commit's actions
    • close

      public void close() throws IOException
      Closes this CommitActionsImpl and releases any underlying resources.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - if an I/O error occurs while closing resources