Class SnapshotBuilderImpl
- All Implemented Interfaces:
SnapshotBuilder
SnapshotBuilder.
Note: The primary responsibility of this class is to take input, validate that input, and then
pass the input to the SnapshotFactory, which is then responsible for actually creating
the Snapshot instance.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatTimestamp(long millisSinceEpochUTC, Snapshot latestSnapshot) Configures the builder to resolve the table at a specific timestamp.atVersion(long version) Configures the builder to resolve the table at a specific version.Constructs theSnapshotusing the provided engine.withCommitter(Committer committer) Provides a custom committer to use at transaction commit time.withLogData(List<ParsedLogData> logDatas) Provides parsed log data to optimize table resolution.withMaxCatalogVersion(long version) Specifies the maximum table version known by the catalog.withProtocolAndMetadata(Protocol protocol, Metadata metadata) Provides protocol and metadata information to optimize table resolution.
-
Constructor Details
-
SnapshotBuilderImpl
-
-
Method Details
-
atVersion
Description copied from interface:SnapshotBuilderConfigures the builder to resolve the table at a specific version.This method is mutually exclusive with
SnapshotBuilder.atTimestamp(long, Snapshot). If both are called, anIllegalArgumentExceptionwill be thrown.- Specified by:
atVersionin interfaceSnapshotBuilder- Parameters:
version- the version number to resolve to- Returns:
- a new builder instance configured for the specified version
-
atTimestamp
Description copied from interface:SnapshotBuilderConfigures the builder to resolve the table at a specific timestamp.This returns a Snapshot for the latest version of the table that was committed before or at the given timestamp. Specifically:
- If a commit version exactly matches the provided timestamp, the snapshot at that version is resolved.
- Otherwise, the latest commit version with a timestamp less than the provided one is resolved.
- If the provided timestamp is less than the timestamp of any committed version, snapshot resolution will fail.
- If the provided timestamp is after (strictly greater than) the timestamp of the latest version of the table, snapshot resolution will fail.
This method is mutually exclusive with
SnapshotBuilder.atVersion(long). If both are called, anIllegalArgumentExceptionwill be thrown.- Specified by:
atTimestampin interfaceSnapshotBuilder- Parameters:
millisSinceEpochUTC- timestamp to resolve the snapshot for in milliseconds since the unix epoch- Returns:
- a new builder instance configured for the specified timestamp
-
withCommitter
Description copied from interface:SnapshotBuilderProvides a custom committer to use at transaction commit time.Catalog implementations that wish to support the catalogManaged Delta table feature should provide to engines their own catalog-specific Committer implementation which may, for example, send a commit RPC to the catalog service to finalize the commit.
If no committer is provided, a default committer will be created that only supports writing into filesystem-managed Delta tables.
- Specified by:
withCommitterin interfaceSnapshotBuilder- Parameters:
committer- the committer to use- Returns:
- a new builder instance with the provided committer
- See Also:
-
withLogData
Description copied from interface:SnapshotBuilderProvides parsed log data to optimize table resolution.When log data is provided, Kernel can avoid reading from the filesystem for information that is already available in the parsed data, improving performance. Currently, only ratified staged commits are supported.
- Specified by:
withLogDatain interfaceSnapshotBuilder- Parameters:
logDatas- the parsed log data to use for optimization- Returns:
- a new builder instance with the provided log data
-
withProtocolAndMetadata
Description copied from interface:SnapshotBuilderProvides protocol and metadata information to optimize table resolution.When protocol and metadata are provided, Kernel can avoid reading this information from the filesystem, improving performance.
- Specified by:
withProtocolAndMetadatain interfaceSnapshotBuilder- Parameters:
protocol- the protocol informationmetadata- the metadata information- Returns:
- a new builder instance with the provided protocol and metadata
-
withMaxCatalogVersion
Description copied from interface:SnapshotBuilderSpecifies the maximum table version known by the catalog.This method is used by catalog implementations for catalog-managed Delta tables to indicate the latest ratified version of the table. This ensures that any snapshot resolution operations respect the catalog's view of the table state.
Important: This method is required for catalog-managed tables and must not be used for file-system managed tables. An
IllegalArgumentExceptionwill be thrown at build time if this constraint is violated.When specified, the following additional constraints are enforced:
- If
SnapshotBuilder.atVersion(long)is used for time travel, the requested version must be less than or equal to the max catalog version. - If
SnapshotBuilder.atTimestamp(long, Snapshot)is used for time travel, the providedlatestSnapshotmust have a version equal to the max catalog version. - If
SnapshotBuilder.withLogData(List)is provided andSnapshotBuilder.atVersion(long)is used, the log data must include the requested version (i.e., the tail of the log data must have a version greater than or equal to the requested version). - If
SnapshotBuilder.withLogData(List)is provided and no version is specified (resolving to latest), the log data must end with the max catalog version.
- Specified by:
withMaxCatalogVersionin interfaceSnapshotBuilder- Parameters:
version- the maximum table version known by the catalog (must be>= 0)- Returns:
- a new builder instance with the specified max catalog version
- If
-
build
Description copied from interface:SnapshotBuilderConstructs theSnapshotusing the provided engine.This method will read any missing information from the filesystem using the provided engine to complete the snapshot resolution process.
- Specified by:
buildin interfaceSnapshotBuilder- Parameters:
engine- the engine to use for filesystem operations- Returns:
- the resolved snapshot instance
-