This is an automated email from the ASF dual-hosted git repository.
alamb 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 2c1161abde port errors.rs test to context.rs (#6340)
2c1161abde is described below
commit 2c1161abde17fee200c87ff23892a1fdf69aabf2
Author: masanobbb <[email protected]>
AuthorDate: Fri May 12 21:25:20 2023 +0900
port errors.rs test to context.rs (#6340)
---
datafusion/core/src/execution/context.rs | 37 ++++++++++++++++++++++
datafusion/core/tests/sql/errors.rs | 54 --------------------------------
datafusion/core/tests/sql/mod.rs | 1 -
3 files changed, 37 insertions(+), 55 deletions(-)
diff --git a/datafusion/core/src/execution/context.rs
b/datafusion/core/src/execution/context.rs
index d76e26e1b7..5d5195e2c4 100644
--- a/datafusion/core/src/execution/context.rs
+++ b/datafusion/core/src/execution/context.rs
@@ -2576,6 +2576,43 @@ mod tests {
Ok(())
}
+ #[tokio::test]
+ async fn unsupported_sql_returns_error() -> Result<()> {
+ let ctx = SessionContext::new();
+ ctx.register_table("test", test::table_with_sequence(1, 1).unwrap())
+ .unwrap();
+ let state = ctx.state();
+
+ // create view
+ let sql = "create view test_view as select * from test";
+ let plan = state.create_logical_plan(sql).await;
+ let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
+ assert!(physical_plan.is_err());
+ assert_eq!(
+ format!("{}", physical_plan.unwrap_err()),
+ "This feature is not implemented: Unsupported logical plan:
CreateView"
+ );
+ // // drop view
+ let sql = "drop view test_view";
+ let plan = state.create_logical_plan(sql).await;
+ let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
+ assert!(physical_plan.is_err());
+ assert_eq!(
+ format!("{}", physical_plan.unwrap_err()),
+ "This feature is not implemented: Unsupported logical plan:
DropView"
+ );
+ // // drop table
+ let sql = "drop table test";
+ let plan = state.create_logical_plan(sql).await;
+ let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
+ assert!(physical_plan.is_err());
+ assert_eq!(
+ format!("{}", physical_plan.unwrap_err()),
+ "This feature is not implemented: Unsupported logical plan:
DropTable"
+ );
+ Ok(())
+ }
+
struct MyPhysicalPlanner {}
#[async_trait]
diff --git a/datafusion/core/tests/sql/errors.rs
b/datafusion/core/tests/sql/errors.rs
deleted file mode 100644
index 343551f1f0..0000000000
--- a/datafusion/core/tests/sql/errors.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use super::*;
-
-#[tokio::test]
-async fn unsupported_sql_returns_error() -> Result<()> {
- let ctx = SessionContext::new();
- register_aggregate_csv(&ctx).await?;
- let state = ctx.state();
-
- // create view
- let sql = "create view test_view as select * from aggregate_test_100";
- let plan = state.create_logical_plan(sql).await;
- let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
- assert!(physical_plan.is_err());
- assert_eq!(
- format!("{}", physical_plan.unwrap_err()),
- "This feature is not implemented: Unsupported logical plan: CreateView"
- );
- // // drop view
- let sql = "drop view test_view";
- let plan = state.create_logical_plan(sql).await;
- let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
- assert!(physical_plan.is_err());
- assert_eq!(
- format!("{}", physical_plan.unwrap_err()),
- "This feature is not implemented: Unsupported logical plan: DropView"
- );
- // // drop table
- let sql = "drop table aggregate_test_100";
- let plan = state.create_logical_plan(sql).await;
- let physical_plan = state.create_physical_plan(&plan.unwrap()).await;
- assert!(physical_plan.is_err());
- assert_eq!(
- format!("{}", physical_plan.unwrap_err()),
- "This feature is not implemented: Unsupported logical plan: DropTable"
- );
- Ok(())
-}
diff --git a/datafusion/core/tests/sql/mod.rs b/datafusion/core/tests/sql/mod.rs
index 7041cf7a1f..8dcae60570 100644
--- a/datafusion/core/tests/sql/mod.rs
+++ b/datafusion/core/tests/sql/mod.rs
@@ -82,7 +82,6 @@ pub mod aggregates;
#[cfg(feature = "avro")]
pub mod avro;
pub mod create_drop;
-pub mod errors;
pub mod explain_analyze;
pub mod expr;
pub mod functions;