Skip to content

Commit c6f7f00

Browse files
authored
fix[vortex-datafusion]: add filename context on read error (#4369)
This has been useful to me to pinpoint the source of the error, allowing me to download and debug further locally. Signed-off-by: Alfonso Subiotto Marques <[email protected]>
1 parent 97c2d6a commit c6f7f00

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vortex-datafusion/src/persistent/opener.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl FileOpener for VortexOpener {
123123
let projection_expr = select(fields, root());
124124

125125
// We share our layout readers with others partitions in the scan, so we can only need to read each layout in each file once.
126-
let layout_reader = match layout_reader.entry(file_meta.object_meta.location) {
126+
let layout_reader = match layout_reader.entry(file_meta.object_meta.location.clone()) {
127127
Entry::Occupied(mut occupied_entry) => {
128128
if let Some(reader) = occupied_entry.get().upgrade() {
129129
log::trace!("reusing layout reader for {}", occupied_entry.key());
@@ -211,7 +211,12 @@ impl FileOpener for VortexOpener {
211211
.map(Ok),
212212
)
213213
})
214-
.map_err(|e: VortexError| ArrowError::ExternalError(Box::new(e)))
214+
.map_err(move |e: VortexError| {
215+
ArrowError::ExternalError(Box::new(e.with_context(format!(
216+
"Failed to read Vortex file: {}",
217+
file_meta.object_meta.location
218+
))))
219+
})
215220
.try_flatten()
216221
.map(move |batch| {
217222
batch.and_then(|b| schema_mapping.map_batch(b).map_err(Into::into))
@@ -253,7 +258,6 @@ fn byte_range_to_row_range(byte_range: Range<u64>, row_count: u64, total_size: u
253258

254259
#[cfg(test)]
255260
mod tests {
256-
257261
use chrono::Utc;
258262
use datafusion::arrow;
259263
use datafusion::arrow::array::RecordBatch;

0 commit comments

Comments
 (0)