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

Method writer

datafusion/catalog/src/stream.rs:206–228  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

204 }
205
206 fn writer(&self) -> Result<Box<dyn RecordBatchWriter>> {
207 match &self.encoding {
208 StreamEncoding::Csv => {
209 let header = self.header && !self.location.exists();
210 let file = OpenOptions::new()
211 .create(true)
212 .append(true)
213 .open(&self.location)?;
214 let writer = arrow::csv::WriterBuilder::new()
215 .with_header(header)
216 .build(file);
217
218 Ok(Box::new(writer))
219 }
220 StreamEncoding::Json => {
221 let file = OpenOptions::new()
222 .create(true)
223 .append(true)
224 .open(&self.location)?;
225 Ok(Box::new(arrow::json::LineDelimitedWriter::new(file)))
226 }
227 }
228 }
229
230 fn stream_write_display(
231 &self,

Callers 6

create_planFunction · 0.45
write_batchFunction · 0.45
write_parquet_fileFunction · 0.45
write_parquetFunction · 0.45
write_parquet_batchesFunction · 0.45
write_allMethod · 0.45

Calls 7

newFunction · 0.85
existsMethod · 0.80
openMethod · 0.45
appendMethod · 0.45
createMethod · 0.45
buildMethod · 0.45
with_headerMethod · 0.45

Tested by 2

write_parquet_fileFunction · 0.36
write_parquetFunction · 0.36