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

Function create_ctx

datafusion/core/src/execution/context/mod.rs:2843–2862  ·  view source on GitHub ↗

Generate a partitioned CSV file and register it with an execution context

(
        tmp_dir: &TempDir,
        partition_count: usize,
    )

Source from the content-addressed store, hash-verified

2841
2842 /// Generate a partitioned CSV file and register it with an execution context
2843 async fn create_ctx(
2844 tmp_dir: &TempDir,
2845 partition_count: usize,
2846 ) -> Result<SessionContext> {
2847 let ctx = SessionContext::new_with_config(
2848 SessionConfig::new().with_target_partitions(8),
2849 );
2850
2851 let schema = populate_csv_partitions(tmp_dir, partition_count, ".csv")?;
2852
2853 // register csv file with the execution context
2854 ctx.register_csv(
2855 "test",
2856 tmp_dir.path().to_str().unwrap(),
2857 CsvReadOptions::new().schema(&schema),
2858 )
2859 .await?;
2860
2861 Ok(ctx)
2862 }
2863
2864 #[derive(Debug)]
2865 struct MyTypePlanner {}

Callers 3

create_variable_exprFunction · 0.85
register_deregisterFunction · 0.85
send_context_to_threadsFunction · 0.85

Calls 6

newFunction · 0.85
populate_csv_partitionsFunction · 0.50
register_csvMethod · 0.45
pathMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…