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

Method print_empty

datafusion-cli/src/print_format.rs:194–214  ·  view source on GitHub ↗

Print when the result batches contain no rows

(
        &self,
        writer: &mut W,
        schema: SchemaRef,
        format_options: &FormatOptions,
    )

Source from the content-addressed store, hash-verified

192
193 /// Print when the result batches contain no rows
194 fn print_empty<W: std::io::Write>(
195 &self,
196 writer: &mut W,
197 schema: SchemaRef,
198 format_options: &FormatOptions,
199 ) -> Result<()> {
200 match self {
201 // Print column headers for Table format
202 Self::Table if !schema.fields().is_empty() => {
203 let format_options: arrow::util::display::FormatOptions =
204 format_options.try_into()?;
205
206 let empty_batch = RecordBatch::new_empty(schema);
207 let formatted =
208 pretty_format_batches_with_options(&[empty_batch], &format_options)?;
209 writeln!(writer, "{formatted}")?;
210 }
211 _ => {}
212 }
213 Ok(())
214 }
215}
216
217#[cfg(test)]

Callers 1

print_batchesMethod · 0.80

Calls 2

is_emptyMethod · 0.45
fieldsMethod · 0.45

Tested by

no test coverage detected