@@ -8,7 +8,6 @@ use arrow::datatypes::{DataType, Field, Schema, TimeUnit};
88use futures:: stream:: { BoxStream , Fuse } ;
99use futures:: StreamExt ;
1010use indexmap:: IndexMap ;
11- use object_store:: path:: Path ;
1211use object_store:: { ListResult , ObjectMeta , ObjectStore } ;
1312use pyo3:: exceptions:: { PyImportError , PyStopAsyncIteration , PyStopIteration } ;
1413use pyo3:: prelude:: * ;
@@ -17,7 +16,7 @@ use pyo3::{intern, IntoPyObjectExt};
1716use pyo3_arrow:: export:: { Arro3RecordBatch , Arro3Table } ;
1817use pyo3_arrow:: PyTable ;
1918use pyo3_async_runtimes:: tokio:: get_runtime;
20- use pyo3_object_store:: { PyObjectStore , PyObjectStoreError , PyObjectStoreResult } ;
19+ use pyo3_object_store:: { PyObjectStore , PyObjectStoreError , PyObjectStoreResult , PyPath } ;
2120use tokio:: sync:: Mutex ;
2221
2322pub ( crate ) struct PyObjectMeta ( ObjectMeta ) ;
@@ -353,8 +352,8 @@ impl<'py> IntoPyObject<'py> for PyListResult {
353352pub ( crate ) fn list (
354353 py : Python ,
355354 store : PyObjectStore ,
356- prefix : Option < String > ,
357- offset : Option < String > ,
355+ prefix : Option < PyPath > ,
356+ offset : Option < PyPath > ,
358357 chunk_size : usize ,
359358 return_arrow : bool ,
360359) -> PyObjectStoreResult < PyListStream > {
@@ -373,7 +372,7 @@ pub(crate) fn list(
373372 let store = store. into_inner ( ) . clone ( ) ;
374373 let prefix = prefix. map ( |s| s. into ( ) ) ;
375374 let stream = if let Some ( offset) = offset {
376- store. list_with_offset ( prefix. as_ref ( ) , & offset. into ( ) )
375+ store. list_with_offset ( prefix. as_ref ( ) , offset. as_ref ( ) )
377376 } else {
378377 store. list ( prefix. as_ref ( ) )
379378 } ;
@@ -385,14 +384,14 @@ pub(crate) fn list(
385384pub ( crate ) fn list_with_delimiter (
386385 py : Python ,
387386 store : PyObjectStore ,
388- prefix : Option < String > ,
387+ prefix : Option < PyPath > ,
389388 return_arrow : bool ,
390389) -> PyObjectStoreResult < PyListResult > {
391390 let runtime = get_runtime ( ) ;
392391 py. detach ( || {
393392 let out = runtime. block_on ( list_with_delimiter_materialize (
394393 store. into_inner ( ) ,
395- prefix. map ( |s| s . into ( ) ) . as_ref ( ) ,
394+ prefix. as_ref ( ) ,
396395 return_arrow,
397396 ) ) ?;
398397 Ok :: < _ , PyObjectStoreError > ( out)
@@ -404,25 +403,24 @@ pub(crate) fn list_with_delimiter(
404403pub ( crate ) fn list_with_delimiter_async (
405404 py : Python ,
406405 store : PyObjectStore ,
407- prefix : Option < String > ,
406+ prefix : Option < PyPath > ,
408407 return_arrow : bool ,
409408) -> PyResult < Bound < PyAny > > {
410409 pyo3_async_runtimes:: tokio:: future_into_py ( py, async move {
411- let out = list_with_delimiter_materialize (
412- store. into_inner ( ) ,
413- prefix. map ( |s| s. into ( ) ) . as_ref ( ) ,
414- return_arrow,
415- )
416- . await ?;
410+ let out =
411+ list_with_delimiter_materialize ( store. into_inner ( ) , prefix. as_ref ( ) , return_arrow)
412+ . await ?;
417413 Ok ( out)
418414 } )
419415}
420416
421417async fn list_with_delimiter_materialize (
422418 store : Arc < dyn ObjectStore > ,
423- prefix : Option < & Path > ,
419+ prefix : Option < & PyPath > ,
424420 return_arrow : bool ,
425421) -> PyObjectStoreResult < PyListResult > {
426- let list_result = store. list_with_delimiter ( prefix) . await ?;
422+ let list_result = store
423+ . list_with_delimiter ( prefix. map ( |s| s. as_ref ( ) ) )
424+ . await ?;
427425 Ok ( PyListResult :: new ( list_result, return_arrow) )
428426}
0 commit comments