diff --git a/kernel/src/listed_log_files.rs b/kernel/src/listed_log_files.rs index 73d82541f..2e0bed1fe 100644 --- a/kernel/src/listed_log_files.rs +++ b/kernel/src/listed_log_files.rs @@ -130,7 +130,7 @@ fn group_checkpoint_parts(parts: Vec) -> HashMap (), // Failed the bounds check above - SinglePartCheckpoint | UuidCheckpoint(_) | MultiPartCheckpoint { .. } => { + SinglePartCheckpoint | UuidCheckpoint | MultiPartCheckpoint { .. } => { new_checkpoint_parts.push(file) } Crc => { diff --git a/kernel/src/path.rs b/kernel/src/path.rs index e94752b12..9d0556ef6 100644 --- a/kernel/src/path.rs +++ b/kernel/src/path.rs @@ -25,7 +25,7 @@ pub(crate) enum LogPathFileType { StagedCommit, SinglePartCheckpoint, #[allow(unused)] - UuidCheckpoint(String), + UuidCheckpoint, // NOTE: Delta spec doesn't actually say, but checkpoint part numbers are effectively 31-bit // unsigned integers: Negative values are never allowed, but Java integer types are always // signed. Approximate that as u32 here. @@ -144,8 +144,8 @@ impl ParsedLogPath { ["crc"] => LogPathFileType::Crc, ["checkpoint", "parquet"] => LogPathFileType::SinglePartCheckpoint, ["checkpoint", uuid, "json" | "parquet"] => { - let uuid = parse_path_part(uuid, UUID_PART_LEN, url)?; - LogPathFileType::UuidCheckpoint(uuid) + let _ = parse_path_part::(uuid, UUID_PART_LEN, url)?; + LogPathFileType::UuidCheckpoint } [hi, "compacted", "json"] => { let hi = parse_path_part(hi, VERSION_LEN, url)?; @@ -181,7 +181,7 @@ impl ParsedLogPath { match self.file_type { LogPathFileType::Commit | LogPathFileType::SinglePartCheckpoint - | LogPathFileType::UuidCheckpoint(_) + | LogPathFileType::UuidCheckpoint | LogPathFileType::MultiPartCheckpoint { .. } | LogPathFileType::CompactedCommit { .. } | LogPathFileType::Crc @@ -204,7 +204,7 @@ impl ParsedLogPath { self.file_type, LogPathFileType::SinglePartCheckpoint | LogPathFileType::MultiPartCheckpoint { .. } - | LogPathFileType::UuidCheckpoint(_) + | LogPathFileType::UuidCheckpoint ) } @@ -472,7 +472,7 @@ mod tests { assert_eq!(log_path.version, 2); assert!(matches!( log_path.file_type, - LogPathFileType::UuidCheckpoint(ref u) if u == "3a0d65cd-4056-49b8-937b-95f9e3ee90e5", + LogPathFileType::UuidCheckpoint )); assert!(!log_path.is_commit()); assert!(log_path.is_checkpoint()); @@ -489,7 +489,7 @@ mod tests { assert_eq!(log_path.version, 2); assert!(matches!( log_path.file_type, - LogPathFileType::UuidCheckpoint(ref u) if u == "3a0d65cd-4056-49b8-937b-95f9e3ee90e5", + LogPathFileType::UuidCheckpoint )); assert!(!log_path.is_commit()); assert!(log_path.is_checkpoint()); @@ -696,11 +696,10 @@ mod tests { assert_eq!(log_path.version, 10); assert!(log_path.is_checkpoint()); assert_eq!(log_path.extension, "parquet"); - if let LogPathFileType::UuidCheckpoint(uuid) = &log_path.file_type { - assert_eq!(uuid.len(), UUID_PART_LEN); - } else { - panic!("Expected UuidCheckpoint file type"); - } + assert!( + matches!(log_path.file_type, LogPathFileType::UuidCheckpoint), + "Expected UuidCheckpoint file type" + ); let filename = log_path.filename.to_string(); let filename_parts: Vec<&str> = filename.split('.').collect(); @@ -786,10 +785,7 @@ mod tests { (LogPathFileType::Commit, true), (LogPathFileType::StagedCommit, false), (LogPathFileType::SinglePartCheckpoint, true), - ( - LogPathFileType::UuidCheckpoint("some-uuid".to_string()), - true, - ), + (LogPathFileType::UuidCheckpoint, true), ( LogPathFileType::MultiPartCheckpoint { part_num: 1,