Class SnapshotManager
Object
io.delta.kernel.internal.snapshot.SnapshotManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildLatestSnapshot(Engine engine) Construct the latest snapshot for given table.voidcheckpoint(Engine engine, long version) getLogSegmentForVersion(Engine engine, Optional<Long> startCheckpoint, Optional<Long> versionToLoad) Get a list of files that can be used to compute a Snapshot at version `versionToLoad`, If `versionToLoad` is not provided, will generate the list of files that are needed to load the latest version of the Delta table.getSnapshotAt(Engine engine, long version) Construct the snapshot for the given table at the version provided.getSnapshotForTimestamp(Engine engine, long millisSinceEpochUTC) Construct the snapshot for the given table at the provided timestamp.static voidverifyDeltaVersions(List<Long> versions, Optional<Long> expectedStartVersion, Optional<Long> expectedEndVersion) - Verify the versions are contiguous.
-
Constructor Details
-
SnapshotManager
-
-
Method Details
-
verifyDeltaVersions
public static void verifyDeltaVersions(List<Long> versions, Optional<Long> expectedStartVersion, Optional<Long> expectedEndVersion) - Verify the versions are contiguous. - Verify the versions start with `expectedStartVersion` if it's specified. - Verify the versions end with `expectedEndVersion` if it's specified. -
buildLatestSnapshot
Construct the latest snapshot for given table.- Parameters:
engine- Instance ofEngineto use.- Returns:
- Throws:
TableNotFoundException
-
getSnapshotAt
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
-
getSnapshotForTimestamp
public Snapshot getSnapshotForTimestamp(Engine engine, long millisSinceEpochUTC) 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
-
checkpoint
- Throws:
TableNotFoundExceptionIOException
-
getLogSegmentForVersion
public Optional<LogSegment> getLogSegmentForVersion(Engine engine, Optional<Long> startCheckpoint, Optional<Long> versionToLoad) Get a list of files that can be used to compute a Snapshot at version `versionToLoad`, If `versionToLoad` is not provided, will generate the list of files that are needed to load the latest version of the Delta table. This method also performs checks to ensure that the delta files are contiguous.- Parameters:
startCheckpoint- A potential start version to perform the listing of the DeltaLog, typically that of a known checkpoint. If this version's not provided, we will start listing from version 0.versionToLoad- A specific version to load. Typically used with time travel and the Delta streaming source. If not provided, we will try to load the latest version of the table.- Returns:
- Some LogSegment to build a Snapshot if files do exist after the given startCheckpoint. None, if the delta log directory was missing or empty.
-