MCPcopy Create free account
hub / github.com/apache/datafusion / from_string_hash_map

Method from_string_hash_map

datafusion/common/src/config.rs:1625–1649  ·  view source on GitHub ↗

Create new ConfigOptions struct, taking values from a string hash map. Only the built-in configurations will be extracted from the hash map and other key value pairs will be ignored.

(settings: &HashMap<String, String>)

Source from the content-addressed store, hash-verified

1623 /// Only the built-in configurations will be extracted from the hash map
1624 /// and other key value pairs will be ignored.
1625 pub fn from_string_hash_map(settings: &HashMap<String, String>) -> Result<Self> {
1626 struct Visitor(Vec<String>);
1627
1628 impl Visit for Visitor {
1629 fn some<V: Display>(&mut self, key: &str, _: V, _: &'static str) {
1630 self.0.push(key.to_string())
1631 }
1632
1633 fn none(&mut self, key: &str, _: &'static str) {
1634 self.0.push(key.to_string())
1635 }
1636 }
1637
1638 let mut keys = Visitor(vec![]);
1639 let mut ret = Self::default();
1640 ret.visit(&mut keys, "datafusion", "");
1641
1642 for key in keys.0 {
1643 if let Some(var) = settings.get(&key) {
1644 ret.set(&key, var)?;
1645 }
1646 }
1647
1648 Ok(ret)
1649 }
1650
1651 /// Returns the [`ConfigEntry`] stored within this [`ConfigOptions`]
1652 pub fn entries(&self) -> Vec<ConfigEntry> {

Callers

nothing calls this directly

Calls 4

VisitorClass · 0.70
visitMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected