diff --git a/python/datafusion/dataframe.py b/python/datafusion/dataframe.py index e283f590..0b38db92 100644 --- a/python/datafusion/dataframe.py +++ b/python/datafusion/dataframe.py @@ -446,14 +446,14 @@ def join( left_on = join_keys[0] right_on = join_keys[1] - if on: - if left_on or right_on: + if on is not None: + if left_on is not None or right_on is not None: raise ValueError( "`left_on` or `right_on` should not provided with `on`" ) left_on = on right_on = on - elif left_on or right_on: + elif left_on is not None or right_on is not None: if left_on is None or right_on is None: raise ValueError("`left_on` and `right_on` should both be provided.") else: diff --git a/python/datafusion/functions.py b/python/datafusion/functions.py index 15ad8822..f3ee5c09 100644 --- a/python/datafusion/functions.py +++ b/python/datafusion/functions.py @@ -431,6 +431,7 @@ def window( partition_by = expr_list_to_raw_expr_list(partition_by) order_by_raw = sort_list_to_raw_sort_list(order_by) window_frame = window_frame.window_frame if window_frame is not None else None + ctx = ctx.ctx if ctx is not None else None return Expr(f.window(name, args, partition_by, order_by_raw, window_frame, ctx)) diff --git a/src/functions.rs b/src/functions.rs index e29c57f9..5c450286 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -16,6 +16,7 @@ // under the License. use datafusion::functions_aggregate::all_default_aggregate_functions; +use datafusion::functions_window::all_default_window_functions; use datafusion::logical_expr::ExprFunctionExt; use datafusion::logical_expr::WindowFrame; use pyo3::{prelude::*, wrap_pyfunction}; @@ -282,6 +283,16 @@ fn find_window_fn(name: &str, ctx: Option) -> PyResult