Class CommitRangeBuilder.CommitBoundary

Object
io.delta.kernel.CommitRangeBuilder.CommitBoundary
Enclosing interface:
CommitRangeBuilder

public static final class CommitRangeBuilder.CommitBoundary extends Object
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 Details

    • atVersion

      public static CommitRangeBuilder.CommitBoundary atVersion(long version)
      Creates a commit boundary based on a specific version number.
      Parameters:
      version - the commit version number, must be non-negative
      Returns:
      a new CommitBoundary representing the specified version
      Throws:
      IllegalArgumentException - if version is 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 epoch
      latestSnapshot - the latest snapshot of the table, used for timestamp resolution
      Returns:
      a new CommitBoundary representing the specified timestamp
    • isVersion

      public boolean isVersion()
      Returns:
      true if this is a version-based boundary, false otherwise
    • isTimestamp

      public boolean isTimestamp()
      Returns:
      true if this is a timestamp-based boundary, false otherwise
    • getVersion

      public long getVersion()
      Returns the version number for version-based boundaries. Callers should check isVersion() 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 check isTimestamp() before access.
      Returns:
      the timestamp in milliseconds since epoch
      Throws:
      IllegalStateException - if this boundary is version-based
    • getLatestSnapshot

      public Snapshot getLatestSnapshot()
      Returns the latest snapshot used for timestamp resolution in timestamp-based boundaries. Callers should check isTimestamp() before access.
      Returns:
      the latest snapshot
      Throws:
      IllegalStateException - if this boundary is version-based
    • toString

      public String toString()
      Overrides:
      toString in class Object