Skip to content

Commit

Permalink
feat: udaf: enable multiple column input (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlovell authored Dec 28, 2023
1 parent 2889de0 commit 76d7fcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def udaf(accum, input_type, return_type, state_type, volatility, name=None):
)
if name is None:
name = accum.__qualname__.lower()
if isinstance(input_type, pa.lib.DataType):
input_type = [input_type]
return AggregateUDF(
name=name,
accumulator=accum,
Expand Down
4 changes: 2 additions & 2 deletions src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ impl PyAggregateUDF {
fn new(
name: &str,
accumulator: PyObject,
input_type: PyArrowType<DataType>,
input_type: PyArrowType<Vec<DataType>>,
return_type: PyArrowType<DataType>,
state_type: PyArrowType<Vec<DataType>>,
volatility: &str,
) -> PyResult<Self> {
let function = create_udaf(
name,
vec![input_type.0],
input_type.0,
Arc::new(return_type.0),
parse_volatility(volatility)?,
to_rust_accumulator(accumulator),
Expand Down

0 comments on commit 76d7fcf

Please sign in to comment.