This is an automated email from the ASF dual-hosted git repository.

yjshen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new f033d9c3b2 fix: return `NotImplemented` when execute `SELECT INTO` 
syntax (#5945)
f033d9c3b2 is described below

commit f033d9c3b2bb038777fdfa2f539e7130eb926cdc
Author: r.4ntix <[email protected]>
AuthorDate: Wed Apr 12 01:26:13 2023 +0800

    fix: return `NotImplemented` when execute `SELECT INTO` syntax (#5945)
    
    * fix: return `NotImplemented` when execute `SELECT INTO` syntax
    
    * chore: add tests for select unsupported syntax
---
 datafusion/sql/src/select.rs             |  3 +++
 datafusion/sql/tests/integration_test.rs | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rs
index a723c7263f..d77c1aefd2 100644
--- a/datafusion/sql/src/select.rs
+++ b/datafusion/sql/src/select.rs
@@ -61,6 +61,9 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         if !select.sort_by.is_empty() {
             return Err(DataFusionError::NotImplemented("SORT BY".to_string()));
         }
+        if select.into.is_some() {
+            return Err(DataFusionError::NotImplemented("INTO".to_string()));
+        }
 
         // process `from` clause
         let plan = self.plan_from_tables(select.from, planner_context)?;
diff --git a/datafusion/sql/tests/integration_test.rs 
b/datafusion/sql/tests/integration_test.rs
index 181e35a466..3749e65573 100644
--- a/datafusion/sql/tests/integration_test.rs
+++ b/datafusion/sql/tests/integration_test.rs
@@ -3366,6 +3366,37 @@ fn test_select_distinct_order_by() {
     assert_eq!(err.to_string(), expected);
 }
 
+#[rstest]
+#[case::select_cluster_by_unsupported(
+    "SELECT customer_name, SUM(order_total) as total_order_amount FROM orders 
CLUSTER BY customer_name",
+    "This feature is not implemented: CLUSTER BY"
+)]
+#[case::select_lateral_view_unsupported(
+    "SELECT id, number FROM person LATERAL VIEW explode(numbers) 
exploded_table AS number",
+    "This feature is not implemented: LATERAL VIEWS"
+)]
+#[case::select_qualify_unsupported(
+    "SELECT i, p, o FROM person QUALIFY ROW_NUMBER() OVER (PARTITION BY p 
ORDER BY o) = 1",
+    "This feature is not implemented: QUALIFY"
+)]
+#[case::select_top_unsupported(
+    "SELECT TOP (5) * FROM person",
+    "This feature is not implemented: TOP"
+)]
+#[case::select_sort_by_unsupported(
+    "SELECT * FROM person SORT BY id",
+    "This feature is not implemented: SORT BY"
+)]
+#[case::select_into_unsupported(
+    "SELECT * INTO test FROM person",
+    "This feature is not implemented: INTO"
+)]
+#[test]
+fn test_select_unsupported_syntax_errors(#[case] sql: &str, #[case] error: 
&str) {
+    let err = logical_plan(sql).unwrap_err();
+    assert_eq!(err.to_string(), error)
+}
+
 #[test]
 fn select_order_by_with_cast() {
     let sql =

Reply via email to