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

Method parse_options_map

datafusion/sql/src/statement.rs:1972–1999  ·  view source on GitHub ↗
(
        &self,
        options: Vec<(String, Value)>,
        allow_duplicates: bool,
    )

Source from the content-addressed store, hash-verified

1970 }
1971
1972 fn parse_options_map(
1973 &self,
1974 options: Vec<(String, Value)>,
1975 allow_duplicates: bool,
1976 ) -> Result<HashMap<String, String>> {
1977 let mut options_map = HashMap::new();
1978 for (key, value) in options {
1979 if !allow_duplicates && options_map.contains_key(&key) {
1980 return plan_err!("Option {key} is specified multiple times");
1981 }
1982
1983 let Some(value_string) = crate::utils::value_to_string(&value) else {
1984 return plan_err!("Unsupported Value {}", value);
1985 };
1986
1987 if !(&key.contains('.')) {
1988 // If config does not belong to any namespace, assume it is
1989 // a format option and apply the format prefix for backwards
1990 // compatibility.
1991 let renamed_key = format!("format.{key}");
1992 options_map.insert(renamed_key.to_lowercase(), value_string);
1993 } else {
1994 options_map.insert(key.to_lowercase(), value_string);
1995 }
1996 }
1997
1998 Ok(options_map)
1999 }
2000
2001 /// Generate a plan for EXPLAIN ... that will print out a plan
2002 ///

Callers 2

copy_to_planMethod · 0.80

Calls 5

newFunction · 0.85
value_to_stringFunction · 0.85
contains_keyMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected