Interface CommitRange

All Known Implementing Classes:
CommitRangeImpl

@Evolving public interface CommitRange
Represents a range of contiguous commits in a Delta Lake table with a defined start and end version. Supports operation on the range of commits, such as reading the delta actions committed in each commit in the version range.

Commit ranges are created using a CommitRangeBuilder, which supports specifying the start and end boundaries of the range. The boundaries can be defined using either versions or timestamps.

Since:
3.4.0
  • Method Details

    • getStartVersion

      long getStartVersion()
      Returns the starting version number (inclusive) of this commit range.
      Returns:
      the starting version number of the commit range
    • getEndVersion

      long getEndVersion()
      Returns the ending version number (inclusive) of this commit range.
      Returns:
      the ending version number of the commit range
    • getQueryStartBoundary

      CommitRangeBuilder.CommitBoundary getQueryStartBoundary()
      Returns the original query boundary used to define the start boundary of this commit range.

      The boundary indicates whether the range was defined using a specific version number or a timestamp.

      Returns:
      the start boundary for this commit range
    • getQueryEndBoundary

      Returns the original query boundary used to define the end boundary of this commit range, if available.

      The boundary indicates whether the range was defined using a specific version number or a timestamp.

      Returns:
      an Optional containing the end boundary, or empty if the range was created with default end parameters (latest version)
    • getActions

      CloseableIterator<ColumnarBatch> getActions(Engine engine, Snapshot startSnapshot, Set<DeltaLogActionUtils.DeltaAction> actionSet)
      Returns an iterator of the requested actions for the commits in this commit range.

      For the returned columnar batches:

      • Each row within the same batch is guaranteed to have the same commit version
      • The batch commit versions are monotonically increasing
      • The top-level columns include "version", "timestamp", and the actions requested in actionSet. "version" and "timestamp" are the first and second columns in the schema, respectively. The remaining columns are based on the actions requested and each have the schema found in DeltaAction.schema.

      The iterator must be closed after use to release any underlying resources.

      Parameters:
      engine - the Engine to use for reading the Delta log files
      startSnapshot - the snapshot for startVersion, required to ensure the table is readable by Kernel at startVersion
      actionSet - the set of action types to include in the results. Only actions of these types will be returned in the iterator
      Returns:
      a CloseableIterator over columnar batches containing the requested actions within this commit range
      Throws:
      IllegalArgumentException - if startSnapshot.getVersion() != startVersion
      KernelException - if the version range contains a version with reader protocol that is unsupported by Kernel
    • getCommitActions

      CloseableIterator<CommitActions> getCommitActions(Engine engine, Snapshot startSnapshot, Set<DeltaLogActionUtils.DeltaAction> actionSet)
      Returns an iterator of commits in this commit range, where each commit is represented as a CommitActions object.
      Parameters:
      engine - the Engine to use for reading the Delta log files
      startSnapshot - the snapshot for startVersion, required to ensure the table is readable by Kernel at startVersion
      actionSet - the set of action types to include in the results. Only actions of these types will be returned in each commit's actions iterator
      Returns:
      a CloseableIterator over CommitActions, one per commit version in this range
      Throws:
      IllegalArgumentException - if startSnapshot.getVersion() != startVersion
      KernelException - if the version range contains a version with reader protocol that is unsupported by Kernel