Class SnapshotFactory

Object
io.delta.kernel.internal.table.SnapshotFactory

public class SnapshotFactory extends Object
Factory class responsible for creating Snapshot instances.

This factory takes validated parameters from SnapshotBuilderImpl and orchestrates the actual snapshot creation process. It handles path resolution, log segment loading, and coordinates with various internal components to construct a fully initialized Snapshot.

Note: The SnapshotBuilderImpl is responsible for receiving and validating all builder parameters, and then passing that information to this factory to actually create the Snapshot.

  • Method Details

    • resolveTimestampToSnapshotVersion

      public static long resolveTimestampToSnapshotVersion(Engine engine, SnapshotQueryContext snapshotQueryCtx, SnapshotImpl latestSnapshot, long millisSinceEpochUTC, List<ParsedLogData> logDatas)
      Resolves the latest table version that exists at or before the given millisSinceEpochUTC.

      Updates the given snapshotQueryCtx with the resolved version and prints out useful log statements.

    • createLazyChecksumFileLoaderWithMetrics

      public static Lazy<Optional<CRCInfo>> createLazyChecksumFileLoaderWithMetrics(Engine engine, Lazy<LogSegment> lazyLogSegment, SnapshotMetrics snapshotMetrics)
      Creates a lazy loader for CRC file information. The CRC file is loaded only once when needed.

      If Lazy.isPresent() is false, then the CRC file was never attempted to be loaded.

      If Lazy.isPresent() is true, then the result is:

      • Optional.empty() if there is no CRC file in this LogSegment, we failed to read it, or we failed to parse it (e.g. missing required fields)
      • Optional.of(crcInfo) if the file exists and was successfully read and parsed