Skip to content
Closed
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
26 changes: 24 additions & 2 deletions kernel/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,19 @@ mod tests {

// ignored - no extension
let log_path = table_log_dir.join("00000000000000000010").unwrap();
let log_path = ParsedLogPath::try_from(log_path).unwrap();
assert!(log_path.is_none());
let result = ParsedLogPath::try_from(log_path);
assert!(
matches!(result, Ok(None)),
"Expected Ok(None) for missing file extension"
);

// empty extension - should be treated as unknown file type
let log_path = table_log_dir.join("00000000000000000011.").unwrap();
let result = ParsedLogPath::try_from(log_path);
assert!(matches!(result, Ok(Some(_))), "Expected Ok(Some) for empty extension");
if let Ok(Some(parsed)) = result {
assert!(parsed.is_unknown(), "Expected Unknown file type for empty extension");
}

// ignored - version fails to parse
let log_path = table_log_dir.join("abc.json").unwrap();
Expand Down Expand Up @@ -322,6 +333,17 @@ mod tests {
));
assert!(!log_path.is_commit());

// Boundary test - UUID with exactly 35 characters (one too short)
let log_path = table_log_dir
.join("00000000000000000010.checkpoint.3a0d65cd-4056-49b8-937b-95f9e3ee90e.parquet")
.unwrap();
let result = ParsedLogPath::try_from(log_path);
assert!(result.is_err(), "Expected an error for UUID with exactly 35 characters");
assert!(
matches!(result, Err(Error::InvalidLogPath(_))),
"Expected InvalidLogPath error for boundary UUID length"
);

// TODO: Support v2 checkpoints! Until then we can't treat these as checkpoint files.
assert!(!log_path.is_checkpoint());
assert!(log_path.is_unknown());
Expand Down
Loading