Skip to content

Commit c368bc1

Browse files
committed
update function signatures to use _bound versions
1 parent 04e65e8 commit c368bc1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/expr/window.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::fmt::{self, Display, Formatter};
2424
use crate::common::df_schema::PyDFSchema;
2525
use crate::errors::py_type_err;
2626
use crate::expr::logical_node::LogicalNode;
27+
use crate::expr::sort_expr::{py_sort_expr_list, PySortExpr};
2728
use crate::expr::PyExpr;
2829
use crate::sql::logical::PyLogicalPlan;
2930

@@ -114,9 +115,9 @@ impl PyWindow {
114115
}
115116

116117
/// Returns order by columns in a window function expression
117-
pub fn get_sort_exprs(&self, expr: PyExpr) -> PyResult<Vec<PyExpr>> {
118+
pub fn get_sort_exprs(&self, expr: PyExpr) -> PyResult<Vec<PySortExpr>> {
118119
match expr.expr.unalias() {
119-
Expr::WindowFunction(WindowFunction { order_by, .. }) => py_expr_list(&order_by),
120+
Expr::WindowFunction(WindowFunction { order_by, .. }) => py_sort_expr_list(&order_by),
120121
other => Err(not_window_function_err(other)),
121122
}
122123
}

src/udf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::sync::Arc;
2020
use pyo3::{prelude::*, types::PyTuple};
2121

2222
use datafusion::arrow::array::{make_array, Array, ArrayData, ArrayRef};
23+
use datafusion::arrow::pyarrow::FromPyArrow;
2324
use datafusion::arrow::datatypes::DataType;
2425
use datafusion::arrow::pyarrow::{PyArrowType, ToPyArrow};
2526
use datafusion::error::DataFusionError;
@@ -43,16 +44,15 @@ fn to_rust_function(func: PyObject) -> ScalarFunctionImplementation {
4344
.iter()
4445
.map(|arg| arg.into_data().to_pyarrow(py).unwrap())
4546
.collect::<Vec<_>>();
46-
let py_args = PyTuple::new(py, py_args);
47+
let py_args = PyTuple::new_bound(py, py_args);
4748

4849
// 2. call function
4950
let value = func
50-
.as_ref(py)
51-
.call(py_args, None)
51+
.call_bound(py, py_args, None)
5252
.map_err(|e| DataFusionError::Execution(format!("{e:?}")))?;
5353

5454
// 3. cast to arrow::array::Array
55-
let array_data = ArrayData::from_pyarrow(value).unwrap();
55+
let array_data = ArrayData::from_pyarrow_bound(value.bind(py)).unwrap();
5656
Ok(make_array(array_data))
5757
})
5858
},

0 commit comments

Comments
 (0)