-
Notifications
You must be signed in to change notification settings - Fork 551
Description
What happened?
When calling get_add_actions() on a Delta table that has no add actions (i.e., no data files), the function panics with exception: PanicException
exc_value: index out of bounds: the len is 0 but the index is 0
This is a regression from version 1.1.4, where this scenario worked correctly without errors.
Root Cause:
The issue is in crates/core/src/table/state.rs at line 358 in the EagerSnapshot::add_actions_table() function:
let result = concat_batches(results[0].schema_ref(), &results)?;This code attempts to access results[0] without checking if the results vector is empty. When there are no files in the table, self.files()? returns an empty iterator, resulting in an empty results vector, which causes the index out of bounds panic.
Expected behavior
The function should handle empty tables gracefully and return an empty RecordBatch with the appropriate schema, similar to how it behaved in version 1.1.4.
Binding
Python (also affects Rust)
Bindings Version
Versions after 1.1.4 (current main branch affected)
Steps to reproduce
- Create or load a Delta table with no data files (e.g., a newly initialized table or a table where all data has been deleted)
- Call
get_add_actions()on the table - Observe the panic
Example code:
from deltalake import DeltaTable
# Load a table with no data files
dt = DeltaTable("path/to/empty/table")
dt.get_add_actions() # This will panicExpected behavior
The function should handle empty tables gracefully and return an empty RecordBatch with the appropriate schema, similar to how it behaved in version 1.1.4.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status