Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provides workaround for half-migrated UDAF sum
Browse files Browse the repository at this point in the history
Michael-J-Ward committed Jun 25, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
1 parent faa26b2 commit 808b328
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/tpch/_tests.py
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ def check_q17(df):
("q10_returned_item_reporting", "q10"),
pytest.param(
"q11_important_stock_identification", "q11",
marks=pytest.mark.xfail # https://github.com/apache/datafusion-python/issues/730
),
("q12_ship_mode_order_priority", "q12"),
("q13_customer_distribution", "q13"),
10 changes: 8 additions & 2 deletions src/functions.rs
Original file line number Diff line number Diff line change
@@ -320,14 +320,20 @@ fn window(
window_frame: Option<PyWindowFrame>,
ctx: Option<PySessionContext>,
) -> PyResult<PyExpr> {
let fun = find_df_window_func(name).or_else(|| {

let fun = if name == "sum" {
let sum_udf = functions_aggregate::sum::sum_udaf();
Some(WindowFunctionDefinition::AggregateUDF(sum_udf))
} else {
find_df_window_func(name).or_else(|| {
ctx.and_then(|ctx| {
ctx.ctx
.udaf(name)
.map(WindowFunctionDefinition::AggregateUDF)
.ok()
})
})
});
};
if fun.is_none() {
return Err(DataFusionError::Common("window function not found".to_string()).into());
}

0 comments on commit 808b328

Please sign in to comment.