Jefffrey commented on code in PR #20864:
URL: https://github.com/apache/datafusion/pull/20864#discussion_r3115737474
##########
datafusion/sql/src/query.rs:
##########
@@ -215,6 +215,19 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
PipeOperator::Join(join) => {
self.parse_relation_join(plan, join, planner_context)
}
+ PipeOperator::Drop { columns } => {
+ let Some((first, rest)) = columns.split_first() else {
+ return plan_err!("DROP requires at least one column");
Review Comment:
Would be good to have a test case covering this
##########
datafusion/sqllogictest/test_files/pipe_operator.slt:
##########
@@ -195,3 +195,30 @@ query TII
----
apples 2 123
bananas 5 NULL
+
+# DROP pipe - drop two columns
+query RT
+SELECT * FROM test |> DROP a, n
+----
+1.1 a
+2.2 b
+3.3 c
+
+# DROP pipe - drop single column
+query IRT
+SELECT * FROM test |> DROP n
+----
+1 1.1 a
+2 2.2 b
+3 3.3 c
+
+# DROP pipe - chained with other operators
+query R
+SELECT * FROM test |> WHERE a > 1 |> DROP a, c, n
+----
+2.2
+3.3
+
+# Error: DROP non-existent column
+statement error
Review Comment:
Could we validate the specific error that comes here too?
--
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]