Skip to content

Commit fcf9475

Browse files
committed
Modifications need to compile against latest DF
1 parent 70cf151 commit fcf9475

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ datafusion = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756
4242
datafusion-substrait = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8", optional = true }
4343
datafusion-proto = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
4444
datafusion-ffi = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
45+
datafusion-functions-window-common = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
4546
prost = "0.13" # keep in line with `datafusion-substrait`
4647
uuid = { version = "1.9", features = ["v4"] }
4748
mimalloc = { version = "0.1", optional = true, default-features = false, features = ["local_dynamic_tls"] }

src/udf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl PyScalarUDF {
9797
let function = create_udf(
9898
name,
9999
input_types.0,
100-
Arc::new(return_type.0),
100+
return_type.0,
101101
parse_volatility(volatility)?,
102102
to_scalar_function_impl(func),
103103
);

src/udwf.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::sync::Arc;
2222
use arrow::array::{make_array, Array, ArrayData, ArrayRef};
2323
use datafusion::logical_expr::window_state::WindowAggState;
2424
use datafusion::scalar::ScalarValue;
25+
use datafusion_functions_window_common::partition::PartitionEvaluatorArgs;
2526
use pyo3::exceptions::PyValueError;
2627
use pyo3::prelude::*;
2728

@@ -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 partition_evaluator(
304+
&self,
305+
partition_evaluator_args: PartitionEvaluatorArgs,
306+
) -> Result<Box<dyn PartitionEvaluator>> {
307+
(self.partition_evaluator_factory)()
304308
}
305309

306-
fn partition_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>> {
307-
(self.partition_evaluator_factory)()
310+
fn field(
311+
&self,
312+
field_args: datafusion::logical_expr::function::WindowUDFFieldArgs,
313+
) -> Result<arrow::datatypes::Field> {
314+
Ok(arrow::datatypes::Field::new(
315+
field_args.name(),
316+
self.return_type.clone(),
317+
true,
318+
))
308319
}
309320
}

0 commit comments

Comments
 (0)