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

Method to_string

datafusion/core/src/dataframe/mod.rs:1518–1532  ·  view source on GitHub ↗

Execute the `DataFrame` and return a string representation of the results. # Example ``` # use datafusion::prelude::*; # use datafusion::error::Result; # use datafusion::execution::SessionStateBuilder; # #[tokio::main] # async fn main() -> Result<()> { let cfg = SessionConfig::new() .set_str("datafusion.format.null", "no-value"); let session_state = SessionStateBuilder::new() .with_config(cfg) .

(self)

Source from the content-addressed store, hash-verified

1516 /// # Ok(())
1517 /// # }
1518 pub async fn to_string(self) -> Result<String> {
1519 let options = self.session_state.config().options().format.clone();
1520 let arrow_options: arrow::util::display::FormatOptions = (&options).try_into()?;
1521
1522 let registry = self.session_state.extension_type_registry();
1523 let formatter_factory = DFArrayFormatterFactory::new(Arc::clone(registry));
1524 let arrow_options =
1525 arrow_options.with_formatter_factory(Some(&formatter_factory));
1526
1527 let results = self.collect().await?;
1528 Ok(
1529 pretty::pretty_format_batches_with_options(&results, &arrow_options)?
1530 .to_string(),
1531 )
1532 }
1533
1534 /// Execute the `DataFrame` and print only the first `num` rows of the
1535 /// result to the console.

Callers 15

random_stringFunction · 0.45
mainFunction · 0.45
check_circular_depsFunction · 0.45
write_csv_to_parquetFunction · 0.45
parse_main_rs_docsFunction · 0.45
generate_examples_readmeFunction · 0.45
detectMethod · 0.45
from_dirMethod · 0.45
format_partFunction · 0.45
group_name_title_casesFunction · 0.45
mainFunction · 0.45
custom_sql_parserFunction · 0.45

Calls 6

newFunction · 0.85
collectMethod · 0.80
cloneMethod · 0.45
optionsMethod · 0.45
configMethod · 0.45