Package io.delta.kernel.internal.metrics
Class SnapshotQueryContext
Object
io.delta.kernel.internal.metrics.SnapshotQueryContext
Stores the context for a given Snapshot query. This includes information about the query
parameters (i.e. table path, time travel parameters), updated state as the snapshot query
progresses (i.e. resolved version), and metrics.
This is used to generate a SnapshotReport. It exists from snapshot query initiation
until either successful snapshot construction or failure.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SnapshotQueryContextforLatestSnapshot(String tablePath) Creates aSnapshotQueryContextfor a Snapshot created by a latest snapshot querystatic SnapshotQueryContextforTimestampSnapshot(String tablePath, long timestamp) Creates aSnapshotQueryContextfor a Snapshot created by a AS OF TIMESTAMP querystatic SnapshotQueryContextforVersionSnapshot(String tablePath, long version) Creates aSnapshotQueryContextfor a Snapshot created by a AS OF VERSION querybooleanReturns true if this snapshot was requested as the latest snapshot (i.e., no time-travel parameters were provided).voidrecordSnapshotErrorReport(Engine engine, Exception e) Creates aSnapshotReportand pushes it to anyMetricsReporters.voidsetCheckpointVersion(Optional<Long> checkpointVersion) Updates thecheckpointVersionstored in this snapshot context.voidsetResolvedVersion(long resolvedVersion) Set the resolved version that was actually loaded for this snapshot query.toString()
-
Method Details
-
forLatestSnapshot
Creates aSnapshotQueryContextfor a Snapshot created by a latest snapshot query -
forVersionSnapshot
Creates aSnapshotQueryContextfor a Snapshot created by a AS OF VERSION query -
forTimestampSnapshot
Creates aSnapshotQueryContextfor a Snapshot created by a AS OF TIMESTAMP query -
getTablePath
-
getResolvedVersion
-
getCheckpointVersion
-
getProvidedTimestamp
-
isLatestQuery
public boolean isLatestQuery()Returns true if this snapshot was requested as the latest snapshot (i.e., no time-travel parameters were provided). Note that this is intent-based - it indicates what the user requested, not whether the snapshot is actually the latest version. -
getSnapshotMetrics
-
getQueryDisplayStr
-
setResolvedVersion
public void setResolvedVersion(long resolvedVersion) Set the resolved version that was actually loaded for this snapshot query.For AS OF TIMESTAMP queries, this should be set upon timestamp-to-version resolution.
For AS OF LATEST queries, this should be set after log segment construction, when we learn what the latest version of the table really is.
-
setCheckpointVersion
Updates thecheckpointVersionstored in this snapshot context. -
recordSnapshotErrorReport
Creates aSnapshotReportand pushes it to anyMetricsReporters. -
toString
-