Skip to content

Commit 45b87f9

Browse files
author
Jiayu Liu
committed
fix per comment
1 parent aa4ced2 commit 45b87f9

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

datafusion/src/physical_plan/planner.rs

+19-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use super::{
2222
functions, hash_join::PartitionMode, udaf, union::UnionExec, windows,
2323
};
2424
use crate::execution::context::ExecutionContextState;
25-
use crate::logical_plan::window_frames::WindowFrame;
2625
use crate::logical_plan::{
2726
DFSchema, Expr, LogicalPlan, Operator, Partitioning as LogicalPartitioning, PlanType,
2827
StringifiedPlan, UserDefinedLogicalNode,
@@ -781,14 +780,31 @@ impl DefaultPhysicalPlanner {
781780
)),
782781
})
783782
.collect::<Result<Vec<_>>>()?;
784-
let window_frame = window_frame.unwrap_or_else(WindowFrame::default);
783+
if !partition_by.is_empty() {
784+
return Err(DataFusionError::NotImplemented(
785+
"window expression with non-empty partition by clause is not yet supported"
786+
.to_owned(),
787+
));
788+
}
789+
if !order_by.is_empty() {
790+
return Err(DataFusionError::NotImplemented(
791+
"window expression with non-empty order by clause is not yet supported"
792+
.to_owned(),
793+
));
794+
}
795+
if window_frame.is_some() {
796+
return Err(DataFusionError::NotImplemented(
797+
"window expression with window frame definition is not yet supported"
798+
.to_owned(),
799+
));
800+
}
785801
windows::create_window_expr(
786802
fun,
787803
name,
788804
&args,
789805
&partition_by,
790806
&order_by,
791-
window_frame,
807+
*window_frame,
792808
physical_input_schema,
793809
)
794810
}

datafusion/src/physical_plan/windows.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ pub fn create_window_expr(
6565
fun: &WindowFunction,
6666
name: String,
6767
args: &[Arc<dyn PhysicalExpr>],
68+
// https://github.com/apache/arrow-datafusion/issues/299
6869
_partition_by: &[Arc<dyn PhysicalExpr>],
70+
// https://github.com/apache/arrow-datafusion/issues/360
6971
_order_by: &[PhysicalSortExpr],
70-
_window_frame: WindowFrame,
72+
// https://github.com/apache/arrow-datafusion/issues/361
73+
_window_frame: Option<WindowFrame>,
7174
input_schema: &Schema,
7275
) -> Result<Arc<dyn WindowExpr>> {
7376
Ok(match fun {
@@ -546,7 +549,7 @@ mod tests {
546549
&[col("c3")],
547550
&[],
548551
&[],
549-
WindowFrame::default(),
552+
Some(WindowFrame::default()),
550553
schema.as_ref(),
551554
)?],
552555
input,
@@ -579,7 +582,7 @@ mod tests {
579582
&[col("c3")],
580583
&[],
581584
&[],
582-
WindowFrame::default(),
585+
Some(WindowFrame::default()),
583586
schema.as_ref(),
584587
)?,
585588
create_window_expr(
@@ -588,7 +591,7 @@ mod tests {
588591
&[col("c3")],
589592
&[],
590593
&[],
591-
WindowFrame::default(),
594+
Some(WindowFrame::default()),
592595
schema.as_ref(),
593596
)?,
594597
create_window_expr(
@@ -597,7 +600,7 @@ mod tests {
597600
&[col("c3")],
598601
&[],
599602
&[],
600-
WindowFrame::default(),
603+
Some(WindowFrame::default()),
601604
schema.as_ref(),
602605
)?,
603606
],

0 commit comments

Comments
 (0)