Skip to content

Commit ec96800

Browse files
committed
More clippy warnings
1 parent ed5da2f commit ec96800

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/dataframe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ impl PyDataFrame {
470470
self.df
471471
.as_ref()
472472
.parse_sql_expr(&expr)
473-
.map(|e| PyExpr::from(e))
473+
.map(PyExpr::from)
474474
.map_err(PyDataFusionError::from)
475475
}
476476

src/expr/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl PyPrepare {
343343
let input = input.plan().clone();
344344
let fields = data_types
345345
.into_iter()
346-
.map(|data_type| DataType::from(data_type))
346+
.map(DataType::from)
347347
.enumerate()
348348
.map(|(idx, data_type)| Field::new(format!("field_{idx}"), data_type, true))
349349
.map(Arc::new)

src/udf.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ use crate::utils::{parse_volatility, validate_pycapsule};
3737

3838
/// Create a Rust callable function from a python function that expects pyarrow arrays
3939
fn pyarrow_function_to_rust(
40-
func: Bound<PyAny>,
40+
func: Py<PyAny>,
4141
) -> impl Fn(&[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
4242
move |args: &[ArrayRef]| -> Result<ArrayRef, DataFusionError> {
4343
Python::attach(|py| {
44+
let func = func.bind(py);
4445
// 1. cast args to Pyarrow arrays
4546
let py_args = args
4647
.iter()
@@ -68,7 +69,7 @@ fn pyarrow_function_to_rust(
6869
/// Create a DataFusion's UDF implementation from a python function
6970
/// that expects pyarrow arrays. This is more efficient as it performs
7071
/// a zero-copy of the contents.
71-
fn to_scalar_function_impl(func: Bound<PyAny>) -> ScalarFunctionImplementation {
72+
fn to_scalar_function_impl(func: Py<PyAny>) -> ScalarFunctionImplementation {
7273
// Make the python function callable from rust
7374
let pyarrow_func = pyarrow_function_to_rust(func);
7475

@@ -93,7 +94,7 @@ impl PyScalarUDF {
9394
#[pyo3(signature=(name, func, input_types, return_type, volatility))]
9495
fn new(
9596
name: &str,
96-
func: Bound<PyAny>,
97+
func: Py<PyAny>,
9798
input_types: PyArrowType<Vec<DataType>>,
9899
return_type: PyArrowType<DataType>,
99100
volatility: &str,

0 commit comments

Comments
 (0)