Package io.delta.kernel.internal.replay
Class LogReplay
Object
io.delta.kernel.internal.replay.LogReplay
Replays a history of actions, resolving them to produce the current state of the table. The
protocol for resolution is as follows:
- The most recent
AddFileand accompanying metadata for any `(path, dv id)` tuple wins. RemoveFiledeletes a corresponding AddFile. ARemoveFile"corresponds" to the AddFile that matches both the parquet file URI *and* the deletion vector's URI (if any).- The most recent
Metadatawins. - The most recent
Protocolversion wins. - For each `(path, dv id)` tuple, this class should always output only one
* FileAction(eitherAddFileorRemoveFile)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic intstatic intstatic Stringstatic final StructTypeRead schema when searching for just the domain metadatastatic intstatic intstatic intstatic Stringstatic final StructTypeRead schema when searching for just the transaction identifiersstatic String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns map for all active domain metadata.getAddFilesAsColumnarBatches(Engine engine, boolean shouldReadStats, Optional<Predicate> checkpointPredicate, ScanMetrics scanMetrics, Optional<PaginationContext> paginationContextOpt) Returns an iterator ofFilteredColumnarBatchrepresenting all the active AddFiles in the table.static StructTypegetAddReadSchema(boolean shouldReadStats) Read schema when searching only for AddFilesstatic StructTypegetAddRemoveReadSchema(boolean shouldReadStats) Read schema when searching for all the active AddFilesReturns the CRC info for the current snapshot version if available.getLatestTransactionIdentifier(Engine engine, String applicationId) longstatic StructTypewithSidecarFileSchema(StructType schema)
-
Field Details
-
SET_TRANSACTION_READ_SCHEMA
Read schema when searching for just the transaction identifiers -
DOMAIN_METADATA_READ_SCHEMA
Read schema when searching for just the domain metadata -
SIDECAR_FIELD_NAME
-
ADDFILE_FIELD_NAME
-
REMOVEFILE_FIELD_NAME
-
ADD_FILE_ORDINAL
public static int ADD_FILE_ORDINAL -
ADD_FILE_PATH_ORDINAL
public static int ADD_FILE_PATH_ORDINAL -
ADD_FILE_DV_ORDINAL
public static int ADD_FILE_DV_ORDINAL -
REMOVE_FILE_ORDINAL
public static int REMOVE_FILE_ORDINAL -
REMOVE_FILE_PATH_ORDINAL
public static int REMOVE_FILE_PATH_ORDINAL -
REMOVE_FILE_DV_ORDINAL
public static int REMOVE_FILE_DV_ORDINAL
-
-
Constructor Details
-
LogReplay
public LogReplay(Engine engine, Path dataPath, Lazy<LogSegment> lazyLogSegment, Lazy<Optional<CRCInfo>> lazyCrcInfo) Creates a new LogReplay instance.- Parameters:
engine- the engine to use for reading log filesdataPath- the path to the Delta tablelazyLogSegment- lazy loader for the log segmentlazyCrcInfo- lazy loader for the CRC file (shared with ProtocolMetadataLogReplay)
-
-
Method Details
-
withSidecarFileSchema
-
containsAddOrRemoveFileActions
-
getAddRemoveReadSchema
Read schema when searching for all the active AddFiles -
getAddReadSchema
Read schema when searching only for AddFiles -
getVersion
public long getVersion() -
getLatestTransactionIdentifier
-
getActiveDomainMetadataMap
Returns map for all active domain metadata. -
getCrcInfoAtSnapshotVersion
Returns the CRC info for the current snapshot version if available. Lazily loads and caches the CRC file on first access. Returns empty if no CRC file exists at the snapshot version. -
getAddFilesAsColumnarBatches
public CloseableIterator<FilteredColumnarBatch> getAddFilesAsColumnarBatches(Engine engine, boolean shouldReadStats, Optional<Predicate> checkpointPredicate, ScanMetrics scanMetrics, Optional<PaginationContext> paginationContextOpt) Returns an iterator ofFilteredColumnarBatchrepresenting all the active AddFiles in the table.Statistics are conditionally read for the AddFiles based on
shouldReadStats. The returned batches have schema:- name:
addtype:
AddFile.SCHEMA_WITH_STATSifshouldReadStats=true, otherwiseAddFile.SCHEMA_WITHOUT_STATS
- name:
-
getLogSegment
-