(
&self,
state: &dyn Session,
format_options: &HashMap<String, String>,
)
| 95 | |
| 96 | impl 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()) |
nothing calls this directly
no test coverage detected