Jefffrey commented on code in PR #17278:
URL: https://github.com/apache/datafusion/pull/17278#discussion_r2365950726
##########
datafusion/sql/src/query.rs:
##########
@@ -78,6 +81,76 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
let plan = self.order_by(plan, order_by_rex)?;
self.limit(plan, query.limit_clause, planner_context)
}
+ }?;
+
+ self.pipe_operators(plan, pipe_operators, planner_context)
+ }
+
+ /// Apply pipe operators to a plan
+ fn pipe_operators(
+ &self,
+ plan: LogicalPlan,
+ pipe_operators: Vec<PipeOperator>,
+ planner_context: &mut PlannerContext,
+ ) -> Result<LogicalPlan> {
+ let mut plan = plan;
+ for pipe_operator in pipe_operators {
+ plan = self.pipe_operator(plan, pipe_operator, planner_context)?;
+ }
+ Ok(plan)
Review Comment:
```suggestion
fn pipe_operators(
&self,
mut plan: LogicalPlan,
pipe_operators: Vec<PipeOperator>,
planner_context: &mut PlannerContext,
) -> Result<LogicalPlan> {
for pipe_operator in pipe_operators {
plan = self.pipe_operator(plan, pipe_operator, planner_context)?;
}
Ok(plan)
```
##########
datafusion/sql/src/query.rs:
##########
@@ -78,6 +81,76 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
let plan = self.order_by(plan, order_by_rex)?;
self.limit(plan, query.limit_clause, planner_context)
}
+ }?;
+
+ self.pipe_operators(plan, pipe_operators, planner_context)
Review Comment:
```suggestion
self.pipe_operators(plan, query.pipe_operators, planner_context)
```
And can remove the `pipe_operators` variable above.
##########
docs/source/user-guide/sql/operators.md:
##########
@@ -613,3 +613,98 @@ bar") |
bar |
+-----------------+
```
+
+## Pipe operators
+
+Some SQL dialects (e.g. BigQuery) support the pipe operator `|>`.
+The SQL dialect can be set like this:
+
+```sql
+set datafusion.sql_parser.dialect = 'BigQuery';
+```
+
+DataFusion currently supports the following pipe operators:
+
+- [WHERE](#pipe_where)
+- [ORDER BY](#pipe_order_by)
+- [LIMIT](#pipe_limit)
+- [SELECT](#pipe_select)
+- [EXTEND](#pipe_extend)
+
+(pipe_where)=
+
+### WHERE
+
+```sql
+> select * from range(0,10)
Review Comment:
```suggestion
select * from range(0,10)
```
Maybe do this to avoid confusion with actual pipe operator itself 🤔
##########
docs/source/user-guide/sql/operators.md:
##########
@@ -613,3 +613,98 @@ bar") |
bar |
+-----------------+
```
+
+## Pipe operators
Review Comment:
Hmm this documentation might belong under `select.md` instead 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]