Skip to content

Commit 1e0b8db

Browse files
committed
fix where pipe before extend
1 parent ca453b2 commit 1e0b8db

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

datafusion/sql/src/query.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::planner::{ContextProvider, PlannerContext, SqlToRel};
2121

2222
use crate::stack::StackGuard;
2323
use datafusion_common::{not_impl_err, Constraints, DFSchema, Result};
24-
use datafusion_expr::expr::Sort;
24+
use datafusion_expr::expr::{Sort, WildcardOptions};
2525

2626
use datafusion_expr::select_expr::SelectExpr;
2727
use datafusion_expr::{
@@ -143,12 +143,10 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
143143
let empty_from = matches!(plan, LogicalPlan::EmptyRelation(_));
144144
let extend_exprs =
145145
self.prepare_select_exprs(&plan, exprs, empty_from, planner_context)?;
146-
let all_exprs = plan
147-
.expressions()
148-
.into_iter()
149-
.map(SelectExpr::Expression)
150-
.chain(extend_exprs)
151-
.collect();
146+
let all_exprs =
147+
std::iter::once(SelectExpr::Wildcard(WildcardOptions::default()))
148+
.chain(extend_exprs)
149+
.collect();
152150
self.project(plan, all_exprs)
153151
}
154152

datafusion/sqllogictest/test_files/pipe_operator.slt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,12 @@ FROM test
8080
1 1.1 2.1
8181
2 2.2 4.2
8282
3 3.3 6.3
83+
84+
query IRR
85+
SELECT *
86+
FROM test
87+
|> SELECT a, b
88+
|> where a = 1
89+
|> EXTEND a + b AS a_plus_b
90+
----
91+
1 1.1 2.1

0 commit comments

Comments
 (0)