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

Function write_output

datafusion-cli/src/print_options.rs:228–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226
227 #[test]
228 fn write_output() -> Result<()> {
229 let instrumented_registry = Arc::new(InstrumentedObjectStoreRegistry::new());
230 let mut print_options = PrintOptions {
231 format: PrintFormat::Automatic,
232 quiet: true,
233 maxrows: MaxRows::Unlimited,
234 color: true,
235 instrumented_registry: Arc::clone(&instrumented_registry),
236 };
237
238 let mut print_output: Vec<u8> = Vec::new();
239 let exec_out = String::from("Formatted Exec Output");
240 print_options.write_output(&mut print_output, &exec_out)?;
241 assert!(print_output.is_empty());
242
243 print_options.quiet = false;
244 print_options.write_output(&mut print_output, &exec_out)?;
245 let out_str: String = print_output
246 .clone()
247 .try_into()
248 .expect("Expected successful String conversion");
249 assert!(out_str.contains(&exec_out));
250
251 // clear the previous data from the output so it doesn't pollute the next test
252 print_output.clear();
253 print_options
254 .instrumented_registry
255 .set_instrument_mode(InstrumentedObjectStoreMode::Trace);
256 print_options.write_output(&mut print_output, &exec_out)?;
257 let out_str: String = print_output
258 .clone()
259 .try_into()
260 .expect("Expected successful String conversion");
261 assert!(out_str.contains(&exec_out));
262 assert!(out_str.contains(OBJECT_STORE_PROFILING_HEADER));
263
264 Ok(())
265 }
266}

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
write_outputMethod · 0.80
set_instrument_modeMethod · 0.80
cloneMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…