Skip to content

Commit 13e1b67

Browse files
committed
cleanup
1 parent 493cca1 commit 13e1b67

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

kernel/src/log_replay.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ impl<'seen> FileActionDeduplicator<'seen> {
119119
}
120120
}
121121
}
122+
122123
impl<'seen> Deduplicator for FileActionDeduplicator<'seen> {
123124
type Key = FileActionKey;
124125
/// Checks if log replay already processed this logical file (in which case the current action

kernel/src/scan/log_replay.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ pub struct SerializableScanState {
4747
pub seen_file_keys: HashSet<FileActionKey>,
4848
}
4949

50-
// These index positions correspond to the order of columns defined in
51-
// `selected_column_names_and_types()`
52-
pub(crate) const ADD_PATH_INDEX: usize = 0; // Position of "add.path" in getters
53-
const ADD_PARTITION_VALUES_INDEX: usize = 1; // Position of "add.partitionValues" in getters
54-
pub(crate) const ADD_DV_START_INDEX: usize = 2; // Start position of add deletion vector columns
55-
const BASE_ROW_ID_INDEX: usize = 5; // Position of add.baseRowId in getters
56-
pub(crate) const REMOVE_PATH_INDEX: usize = 6; // Position of "remove.path" in getters
57-
pub(crate) const REMOVE_DV_START_INDEX: usize = 7; // Start position of remove deletion vector columns
58-
5950
/// [`ScanLogReplayProcessor`] performs log replay (processes actions) specifically for doing a table scan.
6051
///
6152
/// During a table scan, the processor reads batches of log actions (in reverse chronological order)
@@ -90,6 +81,15 @@ pub(crate) struct ScanLogReplayProcessor {
9081
}
9182

9283
impl ScanLogReplayProcessor {
84+
// These index positions correspond to the order of columns defined in
85+
// `selected_column_names_and_types()`
86+
const ADD_PATH_INDEX: usize = 0; // Position of "add.path" in getters
87+
const ADD_PARTITION_VALUES_INDEX: usize = 1; // Position of "add.partitionValues" in getters
88+
const ADD_DV_START_INDEX: usize = 2; // Start position of add deletion vector columns
89+
const BASE_ROW_ID_INDEX: usize = 5; // Position of add.baseRowId in getters
90+
const REMOVE_PATH_INDEX: usize = 6; // Position of "remove.path" in getters
91+
const REMOVE_DV_START_INDEX: usize = 7; // Start position of remove deletion vector columns
92+
9393
/// Create a new [`ScanLogReplayProcessor`] instance
9494
pub(crate) fn new(engine: &dyn Engine, state_info: Arc<StateInfo>) -> DeltaResult<Self> {
9595
Self::new_with_seen_files(engine, state_info, Default::default())
@@ -304,8 +304,8 @@ impl<D: Deduplicator> AddRemoveDedupVisitor<D> {
304304
// encounter if the table's schema was replaced after the most recent checkpoint.
305305
let partition_values = match &self.state_info.transform_spec {
306306
Some(transform) if is_add => {
307-
let partition_values =
308-
getters[ADD_PARTITION_VALUES_INDEX].get(i, "add.partitionValues")?;
307+
let partition_values = getters[ScanLogReplayProcessor::ADD_PARTITION_VALUES_INDEX]
308+
.get(i, "add.partitionValues")?;
309309
let partition_values = parse_partition_values(
310310
&self.state_info.logical_schema,
311311
transform,
@@ -324,7 +324,8 @@ impl<D: Deduplicator> AddRemoveDedupVisitor<D> {
324324
if self.deduplicator.check_and_record_seen(file_key) || !is_add {
325325
return Ok(false);
326326
}
327-
let base_row_id: Option<i64> = getters[BASE_ROW_ID_INDEX].get_opt(i, "add.baseRowId")?;
327+
let base_row_id: Option<i64> =
328+
getters[ScanLogReplayProcessor::BASE_ROW_ID_INDEX].get_opt(i, "add.baseRowId")?;
328329
let transform = self
329330
.state_info
330331
.transform_spec
@@ -496,10 +497,10 @@ impl LogReplayProcessor for ScanLogReplayProcessor {
496497
let deduplicator = FileActionDeduplicator::new(
497498
&mut self.seen_file_keys,
498499
is_log_batch,
499-
ADD_PATH_INDEX,
500-
REMOVE_PATH_INDEX,
501-
ADD_DV_START_INDEX,
502-
REMOVE_DV_START_INDEX,
500+
Self::ADD_PATH_INDEX,
501+
Self::REMOVE_PATH_INDEX,
502+
Self::ADD_DV_START_INDEX,
503+
Self::REMOVE_DV_START_INDEX,
503504
);
504505
let mut visitor = AddRemoveDedupVisitor::new(
505506
deduplicator,

0 commit comments

Comments
 (0)