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

Method fmt_as

datafusion/datasource/src/display.rs:33–52  ·  view source on GitHub ↗
(&self, t: DisplayFormatType, f: &mut Formatter)

Source from the content-addressed store, hash-verified

31
32impl DisplayAs for FileGroupsDisplay<'_> {
33 fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
34 let n_groups = self.0.len();
35 let groups = if n_groups == 1 { "group" } else { "groups" };
36 write!(f, "{{{n_groups} {groups}: [")?;
37 match t {
38 DisplayFormatType::Default | DisplayFormatType::TreeRender => {
39 // To avoid showing too many partitions
40 let max_groups = 5;
41 fmt_up_to_n_elements(self.0, max_groups, f, |group, f| {
42 FileGroupDisplay(group).fmt_as(t, f)
43 })?;
44 }
45 DisplayFormatType::Verbose => {
46 fmt_elements_split_by_commas(self.0.iter(), f, |group, f| {
47 FileGroupDisplay(group).fmt_as(t, f)
48 })?
49 }
50 }
51 write!(f, "]}}")
52 }
53}
54
55/// A wrapper to customize partitioned group of files display

Callers

nothing calls this directly

Calls 7

fmt_up_to_n_elementsFunction · 0.85
FileGroupDisplayClass · 0.85
filesMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected