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

Method try_encode_file_format

datafusion/proto/src/logical_plan/file_formats.rs:239–259  ·  view source on GitHub ↗
(
        &self,
        buf: &mut Vec<u8>,
        node: Arc<dyn FileFormatFactory>,
    )

Source from the content-addressed store, hash-verified

237 }
238
239 fn try_encode_file_format(
240 &self,
241 buf: &mut Vec<u8>,
242 node: Arc<dyn FileFormatFactory>,
243 ) -> datafusion_common::Result<()> {
244 let options = if let Some(csv_factory) = node.downcast_ref::<CsvFormatFactory>() {
245 csv_factory.options.clone().unwrap_or_default()
246 } else {
247 return exec_err!("{}", "Unsupported FileFormatFactory type".to_string());
248 };
249
250 let proto = CsvOptionsProto::from_factory(&CsvFormatFactory {
251 options: Some(options),
252 });
253
254 proto
255 .encode(buf)
256 .map_err(|e| exec_datafusion_err!("Failed to encode CsvOptions: {e:?}"))?;
257
258 Ok(())
259 }
260}
261
262impl JsonOptionsProto {

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected