ryzhyk opened a new issue, #10415:
URL: https://github.com/apache/datafusion/issues/10415

   ### Describe the bug
   
   I am using datafusion 35 via `delta-rs`.  I register an _empty_ delta table 
with datafusion and execute `select * from my_table order by id`, which panics 
[here](https://github.com/apache/datafusion/blob/accce9732e26723cab2ffc521edbf5a3fe7460b3/datafusion/core/src/datasource/physical_plan/file_stream.rs#L263)
 with the following stack trace:
   
   ```
   thread '<unnamed>' panicked at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-35.0.0/src/datasource/physical_plan/file_stream.rs:264:39:
   index out of bounds: the len is 0 but the index is 0
   stack backtrace:
      0: rust_begin_unwind
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:647:5
      1: core::panicking::panic_fmt
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/panicking.rs:72:14
      2: core::panicking::panic_bounds_check
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/panicking.rs:208:5
      3: <usize as core::slice::index::SliceIndex<[T]>>::index
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/slice/index.rs:255:10
      4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/slice/index.rs:18:9
      5: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
                at 
/rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/alloc/src/vec/mod.rs:2771:9
      6: datafusion::datasource::physical_plan::file_stream::FileStream<F>::new
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-35.0.0/src/datasource/physical_plan/file_stream.rs:264:39
      7: <datafusion::datasource::physical_plan::parquet::ParquetExec as 
datafusion_physical_plan::ExecutionPlan>::execute
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-35.0.0/src/datasource/physical_plan/parquet/mod.rs:408:13
      8: <datafusion_physical_plan::sorts::sort::SortExec as 
datafusion_physical_plan::ExecutionPlan>::execute
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-physical-plan-35.0.0/src/sorts/sort.rs:862:25
      9: datafusion_physical_plan::execute_stream
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-physical-plan-35.0.0/src/lib.rs:524:14
     10: datafusion::dataframe::DataFrame::execute_stream::{{closure}}
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-35.0.0/src/dataframe/mod.rs:825:9
     11: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputEndpointInner::execute_df::{{closure}}
                at ./src/integrated/delta_table/input.rs:509:59
     12: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputReader::worker_task_inner::{{closure}}
                at ./src/integrated/delta_table/input.rs:194:18
     13: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputReader::worker_task::{{closure}}::{{closure}}
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/macros/select.rs:524:49
     14: <tokio::future::poll_fn::PollFn<F> as 
core::future::future::Future>::poll
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/future/poll_fn.rs:58:9
     15: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputReader::worker_task::{{closure}}
                at ./src/integrated/delta_table/input.rs:142:9
     16: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputReader::new::{{closure}}::{{closure}}
                at ./src/integrated/delta_table/input.rs:120:18
     17: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/park.rs:281:63
     18: tokio::runtime::coop::with_budget
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/coop.rs:107:5
     19: tokio::runtime::coop::budget
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/coop.rs:73:5
     20: tokio::runtime::park::CachedParkThread::block_on
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/park.rs:281:31
     21: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/context/blocking.rs:66:9
     22: 
tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
     23: tokio::runtime::context::runtime::enter_runtime
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/context/runtime.rs:65:16
     24: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
     25: tokio::runtime::runtime::Runtime::block_on
                at 
/home/leonid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.37.0/src/runtime/runtime.rs:351:45
     26: 
dbsp_adapters::integrated::delta_table::input::DeltaTableInputReader::new::{{closure}}
                at ./src/integrated/delta_table/input.rs:113:13
   ```
   
   ### To Reproduce
   
   This is not a complete reproduction. I was hoping the bug would be obvious 
to developers given the above symptoms.  I'll be happy to create a complete 
reproduction if necessary.
   
   - Create an empty delta table in the local file system:
     ```
     $ ls -alr /tmp/.tmphdmuEp/_delta_log/00000000000000000000.json 
     -rw-rw-r-- 1 leonid leonid 2081 May  7 11:54 
/tmp/.tmphdmuEp/_delta_log/00000000000000000000.json
     ```
   - Open the table using the `deltalake` crate and register it with datafusion:
     ```rust
     datafusion.register_table("my_table", table).unwrap();
     ```
   
   - Query the table:
     ```rust
     let df = datafusion.sql("select * from my_table order by id", 
options).await.unwrap();
     df.collect().await.unwrap();
     ```
   
    
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to