Class SnapshotManager
Object
io.delta.kernel.internal.snapshot.SnapshotManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildLatestSnapshot(Engine engine, SnapshotQueryContext snapshotContext) Construct the latest snapshot for given table.getLogSegmentForVersion(Engine engine, Optional<Long> versionToLoadOpt) Generates aLogSegmentfor the given `versionToLoadOpt`.getLogSegmentForVersion(Engine engine, Optional<Long> timeTravelVersionOpt, List<ParsedLogData> parsedLogDatas, Optional<Long> maxCatalogVersionOpt) [delta-io/delta#4765]: Right now, we only support sorted and contiguous ratified commit log data.getSnapshotAt(Engine engine, long version, SnapshotQueryContext snapshotContext) Construct the snapshot for the given table at the version provided.getSnapshotForTimestamp(Engine engine, SnapshotImpl latestSnapshot, long millisSinceEpochUTC, SnapshotQueryContext snapshotContext) Construct the snapshot for the given table at the provided timestamp.static voidverifyDeltaVersionsContiguous(List<Long> versions, Path tablePath) Verify that a list of delta versions is contiguous.
-
Constructor Details
-
SnapshotManager
-
-
Method Details
-
buildLatestSnapshot
public SnapshotImpl buildLatestSnapshot(Engine engine, SnapshotQueryContext snapshotContext) throws TableNotFoundException Construct the latest snapshot for given table.- Parameters:
engine- Instance ofEngineto use.- Returns:
- the latest
Snapshotof the table - Throws:
TableNotFoundException- if the table does not existInvalidTableException- if the table is in an invalid state
-
getSnapshotAt
public SnapshotImpl getSnapshotAt(Engine engine, long version, SnapshotQueryContext snapshotContext) throws TableNotFoundException Construct the snapshot for the given table at the version provided.- Parameters:
engine- Instance ofEngineto use.version- The snapshot version to construct- Returns:
- a
Snapshotof the table at versionversion - Throws:
TableNotFoundException- if the table does not existInvalidTableException- if the table is in an invalid state
-
getSnapshotForTimestamp
public SnapshotImpl getSnapshotForTimestamp(Engine engine, SnapshotImpl latestSnapshot, long millisSinceEpochUTC, SnapshotQueryContext snapshotContext) throws TableNotFoundException Construct the snapshot for the given table at the provided timestamp.- Parameters:
engine- Instance ofEngineto use.millisSinceEpochUTC- timestamp to fetch the snapshot for in milliseconds since the unix epoch- Returns:
- a
Snapshotof the table at the provided timestamp - Throws:
TableNotFoundException- if the table does not existInvalidTableException- if the table is in an invalid state
-
verifyDeltaVersionsContiguous
@VisibleForTesting public static void verifyDeltaVersionsContiguous(List<Long> versions, Path tablePath) Verify that a list of delta versions is contiguous.- Throws:
InvalidTableException- if the versions are not contiguous
-
getLogSegmentForVersion
Generates aLogSegmentfor the given `versionToLoadOpt`. If no `versionToLoadOpt` is provided, generates aLogSegmentfor the latest version of the table.This primarily consists of three steps:
- First, determine the starting checkpoint version that is at or before `versionToLoadOpt`. If no `versionToLoadOpt` is provided, will use the checkpoint pointed to by the _last_checkpoint file.
- Second, LIST the _delta_log for all delta and checkpoint files newer than the starting checkpoint version.
- Third, process and validate this list of _delta_log files to yield a
LogSegment.
-
getLogSegmentForVersion
public LogSegment getLogSegmentForVersion(Engine engine, Optional<Long> timeTravelVersionOpt, List<ParsedLogData> parsedLogDatas, Optional<Long> maxCatalogVersionOpt) [delta-io/delta#4765]: Right now, we only support sorted and contiguous ratified commit log data.- Parameters:
timeTravelVersionOpt- the version to time-travel to for a time-travel queryparsedLogDatas- the parsed log data from the catalogmaxCatalogVersionOpt- the maximum version ratified by the catalog for catalog managed tables. Empty for file-system managed tables.
-