Skip to content

Commit

Permalink
fix: Allow unbounded window frames
Browse files Browse the repository at this point in the history
  • Loading branch information
MazterQyou committed Dec 22, 2022
1 parent 94ddd00 commit 7d31d40
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions datafusion/core/src/physical_plan/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use arrow::{compute::can_cast_types, datatypes::DataType};
use async_trait::async_trait;
use datafusion_common::OuterQueryCursor;
use datafusion_expr::expr_fn::binary_expr;
use datafusion_expr::WindowFrameBound;
use datafusion_physical_expr::expressions::{any, OuterColumn};
use futures::future::BoxFuture;
use futures::{FutureExt, StreamExt, TryStreamExt};
Expand Down Expand Up @@ -1433,12 +1434,18 @@ pub fn create_window_expr_with_name(
)),
})
.collect::<Result<Vec<_>>>()?;
if window_frame.is_some() {
return Err(DataFusionError::NotImplemented(
"window expression with window frame definition is not yet supported"
.to_owned(),
));
}
let window_frame = match window_frame {
Some(window_frame) => match (&window_frame.start_bound, &window_frame.end_bound) {
(WindowFrameBound::Preceding(None), WindowFrameBound::CurrentRow)
| (WindowFrameBound::Preceding(None), WindowFrameBound::Following(None))
| (WindowFrameBound::CurrentRow, WindowFrameBound::Following(None)) => &None,
(_, _) => return Err(DataFusionError::NotImplemented(
"window expression with window frame definition is not yet supported"
.to_owned(),
)),
},
None => &None,
};
windows::create_window_expr(
fun,
name,
Expand Down

0 comments on commit 7d31d40

Please sign in to comment.