Skip to content

Commit c2164eb

Browse files
fix for panic caused due to empty arrow files (#831)
delete arrow files if found to be empty log error fixes: #830
1 parent 7f7d0f2 commit c2164eb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

server/src/storage/staging.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,19 @@ impl StorageDir {
168168
let random_string =
169169
rand::distributions::Alphanumeric.sample_string(&mut rand::thread_rng(), 15);
170170
for arrow_file_path in arrow_files {
171-
let key = Self::arrow_path_to_parquet(&arrow_file_path, random_string.clone());
172-
grouped_arrow_file
173-
.entry(key)
174-
.or_default()
175-
.push(arrow_file_path);
171+
if arrow_file_path.metadata().unwrap().len() == 0 {
172+
log::error!(
173+
"Invalid arrow file detected, removing it: {:?}",
174+
arrow_file_path
175+
);
176+
fs::remove_file(&arrow_file_path).unwrap();
177+
} else {
178+
let key = Self::arrow_path_to_parquet(&arrow_file_path, random_string.clone());
179+
grouped_arrow_file
180+
.entry(key)
181+
.or_default()
182+
.push(arrow_file_path);
183+
}
176184
}
177185
grouped_arrow_file
178186
}

0 commit comments

Comments
 (0)