Apache DataFusion SQL Query Engine
fix: return `NotImplemented` when execute `SELECT INTO` syntax (#5945)
r.4ntixf033d9c3b2bb
diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rsindex 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` clauselet plan = self.plan_from_tables(select.from, planner_context)?;diff --git a/datafusion/sql/tests/integration_test.rs b/datafusion/sql/tests/integration_test.rsindex 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 =