You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/13 15:24:57 UTC
[GitHub] [arrow-datafusion] capkurmagati commented on a change in pull request #1288: [datafusion-1269]: forbid creating the table with the same name
capkurmagati commented on a change in pull request #1288:
URL: https://github.com/apache/arrow-datafusion/pull/1288#discussion_r748733755
##########
File path: datafusion/src/catalog/schema.rs
##########
@@ -101,4 +115,70 @@ impl SchemaProvider for MemorySchemaProvider {
let mut tables = self.tables.write().unwrap();
Ok(tables.remove(name))
}
+
+ fn table_exist(&self, name: &str) -> bool {
+ let tables = self.tables.read().unwrap();
+ tables.contains_key(name)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use crate::arrow::datatypes::SchemaRef;
+ use crate::catalog::schema::{MemorySchemaProvider, SchemaProvider};
+ use crate::datasource::TableProvider;
+ use crate::logical_plan::Expr;
+ use crate::physical_plan::ExecutionPlan;
+ use std::any::Any;
+ use std::sync::Arc;
+
+ use async_trait::async_trait;
+
+ #[tokio::test]
+ async fn test_mem_provider() {
+ struct TestTableProvider();
Review comment:
Is it necessary to create a test provider?
`EmptyTable` seems enough for the test. You could create a dummy table using `EmptyTable::new(Arc::new(Schema::empty()))`.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org