Package io.delta.kernel.internal.util
Class InCommitTimestampUtils
Object
io.delta.kernel.internal.util.InCommitTimestampUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetUpdatedMetadataWithICTEnablementInfo(Engine engine, long inCommitTimestamp, Optional<SnapshotImpl> readSnapshotOpt, Metadata metadata, long commitVersion) Returns the updatedMetadatawith inCommitTimestamp enablement related info (version and timestamp) correctly set.greatestLowerBound(long target, long lowerBoundInclusive, long upperBoundInclusive, Function<Long, Long> indexToValueMapper) Finds the greatest lower bound of the target value in the range [lowerBoundInclusive, upperBoundInclusive] using binary search.tryExtractInCommitTimestamp(ColumnarBatch firstActionsBatchFromSingleDelta) Tries to extract the inCommitTimestamp from the commitInfo action in the given ColumnarBatch.
-
Constructor Details
-
InCommitTimestampUtils
public InCommitTimestampUtils()
-
-
Method Details
-
getUpdatedMetadataWithICTEnablementInfo
public static Optional<Metadata> getUpdatedMetadataWithICTEnablementInfo(Engine engine, long inCommitTimestamp, Optional<SnapshotImpl> readSnapshotOpt, Metadata metadata, long commitVersion) Returns the updatedMetadatawith inCommitTimestamp enablement related info (version and timestamp) correctly set. This is done only 1. If this transaction enables inCommitTimestamp. 2. If the commit version is not 0. This is because we only need to persist the enablement info if there are non-ICT commits in the Delta log. Note: This function must only be called after transaction conflicts have been resolved. -
tryExtractInCommitTimestamp
public static Optional<Long> tryExtractInCommitTimestamp(ColumnarBatch firstActionsBatchFromSingleDelta) Tries to extract the inCommitTimestamp from the commitInfo action in the given ColumnarBatch. When inCommitTimestamp is enabled, the commitInfo action is always the first action in the delta file. This function assumes that this batch is the leading batch of a single delta file and attempts to extract the commitInfo action from the first row. If the commitInfo action is not present or does not contain an inCommitTimestamp, this function returns an empty Optional. -
greatestLowerBound
public static Optional<Tuple2<Long,Long>> greatestLowerBound(long target, long lowerBoundInclusive, long upperBoundInclusive, Function<Long, Long> indexToValueMapper) Finds the greatest lower bound of the target value in the range [lowerBoundInclusive, upperBoundInclusive] using binary search. The indexToValueMapper function is used to map the index to the corresponding value. Note that this function assumes that the values are sorted in ascending order.- Parameters:
target- The target value to find the greatest lower bound for.lowerBoundInclusive- The lower bound of the search range (inclusive).upperBoundInclusive- The upper bound of the search range (inclusive).indexToValueMapper- A function that maps an index to its corresponding value.- Returns:
- An optional which contains a tuple containing the index and the value of the greatest lower bound when found, or an empty optional if not found.
-