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 395e973 ARROW-9427: [Rust][DataFusion] Added ExecutionContext.tables()
395e973 is described below
commit 395e973d8b01ad814b2e5311a83b366bfe7a6ab4
Author: Jorge C. Leitao <[email protected]>
AuthorDate: Mon Jul 13 08:53:39 2020 -0600
ARROW-9427: [Rust][DataFusion] Added ExecutionContext.tables()
Allows users to know what names can be passed to `table()`.
Closes #7724 from jorgecarleitao/tables
Authored-by: Jorge C. Leitao <[email protected]>
Signed-off-by: Andy Grove <[email protected]>
---
rust/datafusion/src/execution/context.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/rust/datafusion/src/execution/context.rs
b/rust/datafusion/src/execution/context.rs
index 1bc1880..29568b7 100644
--- a/rust/datafusion/src/execution/context.rs
+++ b/rust/datafusion/src/execution/context.rs
@@ -17,7 +17,7 @@
//! ExecutionContext contains methods for registering data sources and
executing queries
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
use std::fs;
use std::path::Path;
use std::string::String;
@@ -267,6 +267,11 @@ impl ExecutionContext {
}
}
+ /// The set of available tables. Use `table` to get a specific table.
+ pub fn tables(&self) -> HashSet<String> {
+ self.datasources.keys().cloned().collect()
+ }
+
/// Optimize the logical plan by applying optimizer rules
pub fn optimize(&self, plan: &LogicalPlan) -> Result<LogicalPlan> {
let rules: Vec<Box<dyn OptimizerRule>> = vec![