Skip to content

Commit 616e9ac

Browse files
feat: Add the in-commit timestamp field to CommitInfo (#581)
## What changes are proposed in this pull request? This PR adds the inCommitTimestamp filed to CommitInfo. This lays the groundwork for supporting ICT for table properties and for writes. We update transaction write tests to ignore the in-commit timestamp field since the write path does not currently support in-commit timestamps. ## How was this change tested? All existing tests pass.
1 parent 606db20 commit 616e9ac

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

kernel/src/actions/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,13 @@ where
331331
struct CommitInfo {
332332
/// The time this logical file was created, as milliseconds since the epoch.
333333
/// Read: optional, write: required (that is, kernel always writes).
334-
/// If in-commit timestamps are enabled, this is always required.
335334
pub(crate) timestamp: Option<i64>,
335+
/// The time this logical file was created, as milliseconds since the epoch. Unlike
336+
/// `timestamp`, this field is guaranteed to be monotonically increase with each commit.
337+
/// Note: If in-commit timestamps are enabled, both the following must be true:
338+
/// - The `inCommitTimestamp` field must always be present in CommitInfo.
339+
/// - The CommitInfo action must always be the first one in a commit.
340+
pub(crate) in_commit_timestamp: Option<i64>,
336341
/// An arbitrary string that identifies the operation associated with this commit. This is
337342
/// specified by the engine. Read: optional, write: required (that is, kernel alwarys writes).
338343
pub(crate) operation: Option<String>,
@@ -694,6 +699,7 @@ mod tests {
694699
"commitInfo",
695700
StructType::new(vec![
696701
StructField::new("timestamp", DataType::LONG, true),
702+
StructField::new("inCommitTimestamp", DataType::LONG, true),
697703
StructField::new("operation", DataType::STRING, true),
698704
StructField::new(
699705
"operationParameters",

kernel/src/transaction.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ fn generate_commit_info(
315315
.get_mut("operationParameters")
316316
.ok_or_else(|| Error::missing_column("operationParameters"))?
317317
.data_type = hack_data_type;
318+
319+
// Since writing in-commit timestamps is not supported, we remove the field so it is not
320+
// written to the log
321+
commit_info_data_type
322+
.fields
323+
.shift_remove("inCommitTimestamp");
318324
commit_info_field.data_type = DataType::Struct(commit_info_data_type);
319325

320326
let commit_info_evaluator = engine.get_expression_handler().get_evaluator(

0 commit comments

Comments
 (0)