Skip to content

Commit

Permalink
Modifications need to compile against latest DF
Browse files Browse the repository at this point in the history
  • Loading branch information
timsaucer committed Oct 14, 2024
1 parent 70cf151 commit fcf9475
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ datafusion = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756
datafusion-substrait = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8", optional = true }
datafusion-proto = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
datafusion-ffi = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
datafusion-functions-window-common = { git = "https://github.com/timsaucer/datafusion.git", rev = "20756df736006253f1ce9e94385b75ab44e268f8" }
prost = "0.13" # keep in line with `datafusion-substrait`
uuid = { version = "1.9", features = ["v4"] }
mimalloc = { version = "0.1", optional = true, default-features = false, features = ["local_dynamic_tls"] }
Expand Down
2 changes: 1 addition & 1 deletion src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl PyScalarUDF {
let function = create_udf(
name,
input_types.0,
Arc::new(return_type.0),
return_type.0,
parse_volatility(volatility)?,
to_scalar_function_impl(func),
);
Expand Down
19 changes: 15 additions & 4 deletions src/udwf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::sync::Arc;
use arrow::array::{make_array, Array, ArrayData, ArrayRef};
use datafusion::logical_expr::window_state::WindowAggState;
use datafusion::scalar::ScalarValue;
use datafusion_functions_window_common::partition::PartitionEvaluatorArgs;
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;

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 partition_evaluator(
&self,
partition_evaluator_args: PartitionEvaluatorArgs,

Check warning on line 305 in src/udwf.rs

View workflow job for this annotation

GitHub Actions / test-matrix (3.10, stable)

unused variable: `partition_evaluator_args`
) -> Result<Box<dyn PartitionEvaluator>> {
(self.partition_evaluator_factory)()
}

fn partition_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>> {
(self.partition_evaluator_factory)()
fn field(
&self,
field_args: datafusion::logical_expr::function::WindowUDFFieldArgs,
) -> Result<arrow::datatypes::Field> {
Ok(arrow::datatypes::Field::new(
field_args.name(),
self.return_type.clone(),
true,
))
}
}

0 comments on commit fcf9475

Please sign in to comment.