Skip to content

Commit

Permalink
add forgotten files (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Jan 24, 2024
1 parent 870da1e commit be43bc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions pyo3-polars-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -220,7 +221,7 @@ fn create_field_function(
)
} else {
quote!(
let result = #dtype_fn_name(&inputs);
let result = #dtype_fn_name(&inputs);
)
};

Expand All @@ -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) => {
Expand Down Expand Up @@ -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;
}
)
Expand Down
4 changes: 2 additions & 2 deletions pyo3-polars/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
Expand Down Expand Up @@ -162,7 +162,7 @@ impl IntoPy<PyObject> 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");

Expand Down

0 comments on commit be43bc0

Please sign in to comment.