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

Function create_ctx_with_partition

datafusion/core/tests/sql/mod.rs:157–175  ·  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

155
156/// Generate a partitioned CSV file and register it with an execution context
157async fn create_ctx_with_partition(
158 tmp_dir: &TempDir,
159 partition_count: usize,
160) -> Result<SessionContext> {
161 let ctx =
162 SessionContext::new_with_config(SessionConfig::new().with_target_partitions(8));
163
164 let schema = populate_csv_partitions(tmp_dir, partition_count, ".csv")?;
165
166 // register csv file with the execution context
167 ctx.register_csv(
168 "test",
169 tmp_dir.path().to_str().unwrap(),
170 CsvReadOptions::new().schema(&schema),
171 )
172 .await?;
173
174 Ok(ctx)
175}
176
177/// Generate CSV partitions within the supplied directory
178fn populate_csv_partitions(

Callers 5

test_prepare_statementFunction · 0.85
execute_with_partitionFunction · 0.85

Calls 6

newFunction · 0.85
populate_csv_partitionsFunction · 0.70
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…