@@ -43,6 +43,7 @@ use crate::arrays::py::PythonArray;
4343use crate :: arrow:: ToPyArrow ;
4444use crate :: dtype:: PyDType ;
4545use crate :: error:: PyVortexError ;
46+ use crate :: error:: PyVortexResult ;
4647use crate :: install_module;
4748use crate :: python_repr:: PythonRepr ;
4849use crate :: scalar:: PyScalar ;
@@ -214,7 +215,7 @@ impl PyArray {
214215 /// -------
215216 /// :class:`~vortex.Array`
216217 #[ staticmethod]
217- fn from_arrow ( obj : Bound < ' _ , PyAny > ) -> Result < PyArrayRef , PyVortexError > {
218+ fn from_arrow ( obj : Bound < ' _ , PyAny > ) -> PyVortexResult < PyArrayRef > {
218219 from_arrow:: from_arrow ( & obj. as_borrowed ( ) )
219220 }
220221
@@ -260,7 +261,7 @@ impl PyArray {
260261 fn from_range (
261262 range : Bound < PyAny > ,
262263 dtype : Option < Bound < PyDType > > ,
263- ) -> Result < PyArrayRef , PyVortexError > {
264+ ) -> PyVortexResult < PyArrayRef > {
264265 let range = range. cast :: < PyRange > ( ) ?;
265266 let start = range. start ( ) ?;
266267 let stop = range. stop ( ) ?;
@@ -317,9 +318,7 @@ impl PyArray {
317318 /// ]
318319 /// ```
319320 ///
320- fn to_arrow_array < ' py > (
321- self_ : & ' py Bound < ' py , Self > ,
322- ) -> Result < Bound < ' py , PyAny > , PyVortexError > {
321+ fn to_arrow_array < ' py > ( self_ : & ' py Bound < ' py , Self > ) -> PyVortexResult < Bound < ' py , PyAny > > {
323322 // NOTE(ngates): for struct arrays, we could also return a RecordBatchStreamReader.
324323 let array = PyArrayRef :: extract ( self_. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
325324 let py = self_. py ( ) ;
@@ -332,9 +331,7 @@ impl PyArray {
332331 let chunks = chunked_array
333332 . chunks ( )
334333 . iter ( )
335- . map ( |chunk| -> Result < _ , PyVortexError > {
336- Ok ( chunk. clone ( ) . into_arrow ( & arrow_dtype) ?)
337- } )
334+ . map ( |chunk| -> PyVortexResult < _ > { Ok ( chunk. clone ( ) . into_arrow ( & arrow_dtype) ?) } )
338335 . collect :: < Result < Vec < ArrowArrayRef > , _ > > ( ) ?;
339336
340337 let pa_data_type = arrow_dtype. clone ( ) . to_pyarrow ( py) ?;
@@ -425,42 +422,42 @@ impl PyArray {
425422 }
426423
427424 ///Rust docs are *not* copied into Python for __lt__: https://github.com/PyO3/pyo3/issues/4326
428- fn __lt__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
425+ fn __lt__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
429426 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
430427 let inner = compare ( & slf, & * other, Operator :: Lt ) ?;
431428 Ok ( PyArrayRef :: from ( inner) )
432429 }
433430
434431 ///Rust docs are *not* copied into Python for __le__: https://github.com/PyO3/pyo3/issues/4326
435- fn __le__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
432+ fn __le__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
436433 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
437434 let inner = compare ( & * slf, & * other, Operator :: Lte ) ?;
438435 Ok ( PyArrayRef :: from ( inner) )
439436 }
440437
441438 ///Rust docs are *not* copied into Python for __eq__: https://github.com/PyO3/pyo3/issues/4326
442- fn __eq__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
439+ fn __eq__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
443440 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
444441 let inner = compare ( & * slf, & * other, Operator :: Eq ) ?;
445442 Ok ( PyArrayRef :: from ( inner) )
446443 }
447444
448445 ///Rust docs are *not* copied into Python for __ne__: https://github.com/PyO3/pyo3/issues/4326
449- fn __ne__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
446+ fn __ne__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
450447 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
451448 let inner = compare ( & * slf, & * other, Operator :: NotEq ) ?;
452449 Ok ( PyArrayRef :: from ( inner) )
453450 }
454451
455452 ///Rust docs are *not* copied into Python for __ge__: https://github.com/PyO3/pyo3/issues/4326
456- fn __ge__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
453+ fn __ge__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
457454 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
458455 let inner = compare ( & * slf, & * other, Operator :: Gte ) ?;
459456 Ok ( PyArrayRef :: from ( inner) )
460457 }
461458
462459 ///Rust docs are *not* copied into Python for __gt__: https://github.com/PyO3/pyo3/issues/4326
463- fn __gt__ ( slf : Bound < Self > , other : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
460+ fn __gt__ ( slf : Bound < Self > , other : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
464461 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
465462 let inner = compare ( & * slf, & * other, Operator :: Gt ) ?;
466463 Ok ( PyArrayRef :: from ( inner) )
@@ -494,7 +491,7 @@ impl PyArray {
494491 /// 5
495492 /// ]
496493 /// ```
497- fn filter ( slf : Bound < Self > , mask : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
494+ fn filter ( slf : Bound < Self > , mask : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
498495 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
499496 let mask = ( & * mask as & dyn Array ) . to_bool ( ) . to_mask_fill_null_false ( ) ;
500497 let inner = vortex:: compute:: filter ( & * slf, & mask) ?;
@@ -620,7 +617,7 @@ impl PyArray {
620617 /// "a"
621618 /// ]
622619 /// ```
623- fn take ( slf : Bound < Self > , indices : PyArrayRef ) -> Result < PyArrayRef , PyVortexError > {
620+ fn take ( slf : Bound < Self > , indices : PyArrayRef ) -> PyVortexResult < PyArrayRef > {
624621 let slf = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?. into_inner ( ) ;
625622
626623 if !indices. dtype ( ) . is_int ( ) {
@@ -678,7 +675,7 @@ impl PyArray {
678675 . to_string ( ) )
679676 }
680677
681- fn serialize ( slf : & Bound < Self > , ctx : & PyArrayContext ) -> Result < Vec < Vec < u8 > > , PyVortexError > {
678+ fn serialize ( slf : & Bound < Self > , ctx : & PyArrayContext ) -> PyVortexResult < Vec < Vec < u8 > > > {
682679 // FIXME(ngates): do not copy to vec, use buffer protocol
683680 let array = PyArrayRef :: extract ( slf. as_any ( ) . as_borrowed ( ) ) ?;
684681 Ok ( array
0 commit comments