Skip to content

Commit d43bb21

Browse files
update PyWindowUDF
Ref: apache/datafusion#12803
1 parent 078dca8 commit d43bb21

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/udwf.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::ops::Range;
2020
use std::sync::Arc;
2121

2222
use arrow::array::{make_array, Array, ArrayData, ArrayRef};
23+
use datafusion::logical_expr::function::{PartitionEvaluatorArgs, WindowUDFFieldArgs};
2324
use datafusion::logical_expr::window_state::WindowAggState;
2425
use datafusion::scalar::ScalarValue;
2526
use pyo3::exceptions::PyValueError;
@@ -299,11 +300,21 @@ impl WindowUDFImpl for MultiColumnWindowUDF {
299300
&self.signature
300301
}
301302

302-
fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
303-
Ok(self.return_type.clone())
303+
fn field(&self, field_args: WindowUDFFieldArgs) -> Result<arrow::datatypes::Field> {
304+
// TODO: Should nullable always be `true`?
305+
Ok(arrow::datatypes::Field::new(
306+
field_args.name(),
307+
self.return_type.clone(),
308+
true,
309+
))
304310
}
305311

306-
fn partition_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>> {
312+
// TODO: Enable passing partition_evaluator_args to python?
313+
fn partition_evaluator(
314+
&self,
315+
_partition_evaluator_args: PartitionEvaluatorArgs,
316+
) -> Result<Box<dyn PartitionEvaluator>> {
317+
let _ = _partition_evaluator_args;
307318
(self.partition_evaluator_factory)()
308319
}
309320
}

0 commit comments

Comments
 (0)