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

Function format_part

datafusion-examples/src/utils/example_metadata/model.rs:156–168  ·  view source on GitHub ↗

Formats a single group-name segment for display. This function applies DataFusion-specific capitalization rules: - Known abbreviations (e.g. `sql`, `io`, `udf`) are rendered in all caps - All other segments fall back to standard Title Case

(part: &str)

Source from the content-addressed store, hash-verified

154/// - Known abbreviations (e.g. `sql`, `io`, `udf`) are rendered in all caps
155/// - All other segments fall back to standard Title Case
156fn format_part(part: &str) -> String {
157 let lower = part.to_ascii_lowercase();
158
159 if let Some((_, replacement)) = ABBREVIATIONS.iter().find(|(k, _)| *k == lower) {
160 return replacement.to_string();
161 }
162
163 let mut chars = part.chars();
164 match chars.next() {
165 Some(first) => first.to_uppercase().collect::<String>() + chars.as_str(),
166 None => String::new(),
167 }
168}
169
170#[cfg(test)]
171mod tests {

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
iterMethod · 0.45
to_stringMethod · 0.45
nextMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…