Skip to content

Commit

Permalink
update PyWindowUDF
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-J-Ward committed Oct 15, 2024
1 parent df9197b commit 7255ec2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/udwf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::ops::Range;
use std::sync::Arc;

use arrow::array::{make_array, Array, ArrayData, ArrayRef};
use datafusion::logical_expr::function::{PartitionEvaluatorArgs, WindowUDFFieldArgs};
use datafusion::logical_expr::window_state::WindowAggState;
use datafusion::scalar::ScalarValue;
use pyo3::exceptions::PyValueError;
Expand Down Expand Up @@ -299,11 +300,21 @@ impl WindowUDFImpl for MultiColumnWindowUDF {
&self.signature
}

fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
Ok(self.return_type.clone())
fn field(&self, _field_args: WindowUDFFieldArgs) -> Result<arrow::datatypes::Field> {
// TODO: Should nulalble always be `true`?
Ok(arrow::datatypes::Field::new(
self.name(),
self.return_type.clone(),
true,
))
}

fn partition_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>> {
// TODO: Enable passing partition_evaluator_args to python?
fn partition_evaluator(
&self,
_partition_evaluator_args: PartitionEvaluatorArgs,
) -> Result<Box<dyn PartitionEvaluator>> {
let _ = _partition_evaluator_args;
(self.partition_evaluator_factory)()
}
}

0 comments on commit 7255ec2

Please sign in to comment.