This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new af9ee7d ARROW-9425: [Rust][DataFusion] Made ExecutionContext sharable
and sync
af9ee7d is described below
commit af9ee7da916e69b3f722eba6385b6d47e2bfd0fd
Author: Jorge C. Leitao <[email protected]>
AuthorDate: Mon Jul 13 08:51:57 2020 -0600
ARROW-9425: [Rust][DataFusion] Made ExecutionContext sharable and sync
This is required when the library is used by other applications that
leverage a long-living context.
Closes #7723 from jorgecarleitao/thread_safe
Authored-by: Jorge C. Leitao <[email protected]>
Signed-off-by: Andy Grove <[email protected]>
---
rust/datafusion/src/execution/context.rs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/rust/datafusion/src/execution/context.rs
b/rust/datafusion/src/execution/context.rs
index 1974eca..1bc1880 100644
--- a/rust/datafusion/src/execution/context.rs
+++ b/rust/datafusion/src/execution/context.rs
@@ -63,7 +63,7 @@ use sqlparser::sqlast::{SQLColumnDef, SQLType};
/// Execution context for registering data sources and executing queries
pub struct ExecutionContext {
- datasources: HashMap<String, Box<dyn TableProvider>>,
+ datasources: HashMap<String, Box<dyn TableProvider + Send + Sync>>,
scalar_functions: HashMap<String, Box<ScalarFunction>>,
}
@@ -236,7 +236,11 @@ impl ExecutionContext {
}
/// Register a table so that it can be queried from SQL
- pub fn register_table(&mut self, name: &str, provider: Box<dyn
TableProvider>) {
+ pub fn register_table(
+ &mut self,
+ name: &str,
+ provider: Box<dyn TableProvider + Send + Sync>,
+ ) {
self.datasources.insert(name.to_string(), provider);
}
@@ -614,7 +618,7 @@ impl ExecutionContext {
}
struct ExecutionContextSchemaProvider<'a> {
- datasources: &'a HashMap<String, Box<dyn TableProvider>>,
+ datasources: &'a HashMap<String, Box<dyn TableProvider + Send + Sync>>,
scalar_functions: &'a HashMap<String, Box<ScalarFunction>>,
}