Package io.delta.kernel
Class CommitRangeBuilder.CommitBoundary
Object
io.delta.kernel.CommitRangeBuilder.CommitBoundary
- Enclosing interface:
CommitRangeBuilder
Defines a boundary (start or end) of a commit range in a Delta Lake table.
A CommitBoundary can be based on either a specific version number or a timestamp.
When using timestamps, the boundary requires the latest snapshot to help resolve the timestamp
to the appropriate version.
Use the static factory methods atVersion(long) and atTimestamp(long, Snapshot) to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionatTimestamp(long timestamp, Snapshot latestSnapshot) Creates a commit boundary based on a timestamp.atVersion(long version) Creates a commit boundary based on a specific version number.Returns the latest snapshot used for timestamp resolution in timestamp-based boundaries.longReturns the timestamp for timestamp-based boundaries.longReturns the version number for version-based boundaries.booleanbooleantoString()
-
Method Details
-
atVersion
Creates a commit boundary based on a specific version number.- Parameters:
version- the commit version number, must be non-negative- Returns:
- a new
CommitBoundaryrepresenting the specified version - Throws:
IllegalArgumentException- ifversionis negative
-
atTimestamp
public static CommitRangeBuilder.CommitBoundary atTimestamp(long timestamp, Snapshot latestSnapshot) Creates a commit boundary based on a timestamp.The timestamp represents a point in time, and the boundary will resolve to the appropriate commit version.
- Parameters:
timestamp- the timestamp in milliseconds since epochlatestSnapshot- the latest snapshot of the table, used for timestamp resolution- Returns:
- a new
CommitBoundaryrepresenting the specified timestamp
-
isVersion
public boolean isVersion()- Returns:
trueif this is a version-based boundary,falseotherwise
-
isTimestamp
public boolean isTimestamp()- Returns:
trueif this is a timestamp-based boundary,falseotherwise
-
getVersion
public long getVersion()Returns the version number for version-based boundaries. Callers should checkisVersion()before access.- Returns:
- the version number
- Throws:
IllegalStateException- if this boundary is timestamp-based
-
getTimestamp
public long getTimestamp()Returns the timestamp for timestamp-based boundaries. Callers should checkisTimestamp()before access.- Returns:
- the timestamp in milliseconds since epoch
- Throws:
IllegalStateException- if this boundary is version-based
-
getLatestSnapshot
Returns the latest snapshot used for timestamp resolution in timestamp-based boundaries. Callers should checkisTimestamp()before access.- Returns:
- the latest snapshot
- Throws:
IllegalStateException- if this boundary is version-based
-
toString
-