Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kernel/src/listed_log_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn group_checkpoint_parts(parts: Vec<ParsedLogPath>) -> HashMap<u32, Vec<ParsedL
use LogPathFileType::*;
match &part_file.file_type {
SinglePartCheckpoint
| UuidCheckpoint(_)
| UuidCheckpoint
| MultiPartCheckpoint {
part_num: 1,
num_parts: 1,
Expand Down Expand Up @@ -270,7 +270,7 @@ impl ListedLogFiles {
ascending_compaction_files.push(file);
}
CompactedCommit { .. } => (), // Failed the bounds check above
SinglePartCheckpoint | UuidCheckpoint(_) | MultiPartCheckpoint { .. } => {
SinglePartCheckpoint | UuidCheckpoint | MultiPartCheckpoint { .. } => {
new_checkpoint_parts.push(file)
}
Crc => {
Expand Down
28 changes: 12 additions & 16 deletions kernel/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -144,8 +144,8 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
["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::<String>(uuid, UUID_PART_LEN, url)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually care that it's a valid UUID if we never use it for anything but a filename?
(but the Delta spec does say it must be a UUID, so I guess we have to)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think we might as well verify it

LogPathFileType::UuidCheckpoint
}
[hi, "compacted", "json"] => {
let hi = parse_path_part(hi, VERSION_LEN, url)?;
Expand Down Expand Up @@ -181,7 +181,7 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
match self.file_type {
LogPathFileType::Commit
| LogPathFileType::SinglePartCheckpoint
| LogPathFileType::UuidCheckpoint(_)
| LogPathFileType::UuidCheckpoint
| LogPathFileType::MultiPartCheckpoint { .. }
| LogPathFileType::CompactedCommit { .. }
| LogPathFileType::Crc
Expand All @@ -204,7 +204,7 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
self.file_type,
LogPathFileType::SinglePartCheckpoint
| LogPathFileType::MultiPartCheckpoint { .. }
| LogPathFileType::UuidCheckpoint(_)
| LogPathFileType::UuidCheckpoint
)
}

Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down
Loading