Package io.delta.kernel
Interface CommitRange
- All Known Implementing Classes:
CommitRangeImpl
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 Summary
Modifier and TypeMethodDescriptiongetActions(Engine engine, Snapshot startSnapshot, Set<DeltaLogActionUtils.DeltaAction> actionSet) Returns an iterator of the requested actions for the commits in this commit range.getCommitActions(Engine engine, Snapshot startSnapshot, Set<DeltaLogActionUtils.DeltaAction> actionSet) Returns an iterator of commits in this commit range, where each commit is represented as aCommitActionsobject.longReturns the ending version number (inclusive) of this commit range.Returns the original query boundary used to define the end boundary of this commit range, if available.Returns the original query boundary used to define the start boundary of this commit range.longReturns the starting version number (inclusive) of this commit range.
-
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
Optional<CommitRangeBuilder.CommitBoundary> 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
Optionalcontaining 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- theEngineto use for reading the Delta log filesstartSnapshot- the snapshot for startVersion, required to ensure the table is readable by Kernel at startVersionactionSet- the set of action types to include in the results. Only actions of these types will be returned in the iterator- Returns:
- a
CloseableIteratorover columnar batches containing the requested actions within this commit range - Throws:
IllegalArgumentException- if startSnapshot.getVersion() != startVersionKernelException- 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 aCommitActionsobject.- Parameters:
engine- theEngineto use for reading the Delta log filesstartSnapshot- the snapshot for startVersion, required to ensure the table is readable by Kernel at startVersionactionSet- 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
CloseableIteratoroverCommitActions, one per commit version in this range - Throws:
IllegalArgumentException- if startSnapshot.getVersion() != startVersionKernelException- if the version range contains a version with reader protocol that is unsupported by Kernel
-