diff --git a/pyo3-polars-derive/src/lib.rs b/pyo3-polars-derive/src/lib.rs index be4c8f3..166708c 100644 --- a/pyo3-polars-derive/src/lib.rs +++ b/pyo3-polars-derive/src/lib.rs @@ -28,6 +28,7 @@ fn quote_get_kwargs() -> proc_macro2::TokenStream { let kwargs = match pyo3_polars::derive::_parse_kwargs(kwargs) { Ok(value) => value, Err(err) => { + let err = polars_err!(InvalidOperation: "could not parse kwargs: '{}'\n\nCheck: registration of kwargs in the plugin.", err); pyo3_polars::derive::_update_last_error(err); return; } @@ -220,7 +221,7 @@ fn create_field_function( ) } else { quote!( - let result = #dtype_fn_name(&inputs); + let result = #dtype_fn_name(&inputs); ) }; @@ -240,7 +241,7 @@ fn create_field_function( match result { Ok(out) => { - let out = polars_core::export::arrow::ffi::export_field_to_c(&out.to_arrow()); + let out = polars_core::export::arrow::ffi::export_field_to_c(&out.to_arrow(true)); *return_value = out; }, Err(err) => { @@ -277,7 +278,7 @@ fn create_field_function_from_with_dtype( let mapper = polars_plan::dsl::FieldsMapper::new(&inputs); let dtype = polars_core::datatypes::DataType::#dtype; let out = mapper.with_dtype(dtype).unwrap(); - let out = polars_core::export::arrow::ffi::export_field_to_c(&out.to_arrow()); + let out = polars_core::export::arrow::ffi::export_field_to_c(&out.to_arrow(true)); *return_value = out; } ) diff --git a/pyo3-polars/src/lib.rs b/pyo3-polars/src/lib.rs index 237b796..7d61c62 100644 --- a/pyo3-polars/src/lib.rs +++ b/pyo3-polars/src/lib.rs @@ -123,7 +123,7 @@ impl<'a> FromPyObject<'a> for PySeries { let name = ob.getattr("name")?; let name = name.str()?.to_str()?; - let arr = ob.call_method0("to_arrow")?; + let arr = ob.call_method1("to_arrow", (true,))?; let arr = ffi::to_rust::array_to_rust(arr)?; Ok(PySeries( Series::try_from((name, arr)).map_err(PyPolarsErr::from)?, @@ -162,7 +162,7 @@ impl IntoPy for PySeries { fn into_py(self, py: Python<'_>) -> PyObject { let s = self.0.rechunk(); let name = s.name(); - let arr = s.to_arrow(0); + let arr = s.to_arrow(0, true); let pyarrow = py.import("pyarrow").expect("pyarrow not installed"); let polars = py.import("polars").expect("polars not installed");