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

Function open_writer

benchmarks/src/bin/gen_wide_data.rs:233–250  ·  view source on GitHub ↗
(
    path: &Path,
    schema: SchemaRef,
    rows_per_group: usize,
)

Source from the content-addressed store, hash-verified

231}
232
233fn open_writer(
234 path: &Path,
235 schema: SchemaRef,
236 rows_per_group: usize,
237) -> Result<ArrowWriter<File>> {
238 if let Some(parent) = path.parent() {
239 std::fs::create_dir_all(parent)
240 .map_err(|e| exec_datafusion_err!("creating {}: {e}", parent.display()))?;
241 }
242 let file = File::create(path)
243 .map_err(|e| exec_datafusion_err!("creating {}: {e}", path.display()))?;
244 let writer_props = WriterProperties::builder()
245 .set_max_row_group_row_count(Some(rows_per_group.max(1)))
246 .set_compression(Compression::ZSTD(ZstdLevel::try_new(1).unwrap()))
247 .build();
248 ArrowWriter::try_new(file, schema, Some(writer_props))
249 .map_err(|e| exec_datafusion_err!("creating ArrowWriter: {e}"))
250}
251
252fn main() -> Result<()> {
253 let cli = Cli::parse();

Callers 1

mainFunction · 0.85

Calls 3

createFunction · 0.85
buildMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…