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

Method create

datafusion/datasource-csv/src/file_format.rs:97–119  ·  view source on GitHub ↗
(
        &self,
        state: &dyn Session,
        format_options: &HashMap<String, String>,
    )

Source from the content-addressed store, hash-verified

95
96impl FileFormatFactory for CsvFormatFactory {
97 fn create(
98 &self,
99 state: &dyn Session,
100 format_options: &HashMap<String, String>,
101 ) -> Result<Arc<dyn FileFormat>> {
102 let csv_options = match &self.options {
103 None => {
104 let mut table_options = state.default_table_options();
105 table_options.set_config_format(ConfigFileType::CSV);
106 table_options.alter_with_string_hash_map(format_options)?;
107 table_options.csv
108 }
109 Some(csv_options) => {
110 let mut csv_options = csv_options.clone();
111 for (k, v) in format_options {
112 csv_options.set(k, v)?;
113 }
114 csv_options
115 }
116 };
117
118 Ok(Arc::new(CsvFormat::default().with_options(csv_options)))
119 }
120
121 fn default(&self) -> Arc<dyn FileFormat> {
122 Arc::new(CsvFormat::default())

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
set_config_formatMethod · 0.80
default_table_optionsMethod · 0.45
cloneMethod · 0.45
setMethod · 0.45
with_optionsMethod · 0.45

Tested by

no test coverage detected