berkaysynnada commented on code in PR #16166:
URL: https://github.com/apache/datafusion/pull/16166#discussion_r2113297575


##########
datafusion/datasource/src/file_format.rs:
##########
@@ -120,7 +121,26 @@ pub trait FileFormatFactory: Sync + Send + GetExt + 
fmt::Debug {
         &self,
         state: &dyn Session,
         format_options: &HashMap<String, String>,
-    ) -> Result<Arc<dyn FileFormat>>;
+    ) -> Result<Arc<dyn FileFormat>> {
+        let options = match self.options() {
+            (None, file_type) => {
+                let mut table_options = state.file_table_options(file_type);
+                table_options.alter_with_string_hash_map(format_options)?;
+                table_options.output_format()
+            }
+            (Some(options), _) => {
+                let mut table_options = 
TableFormatOptions::from_output_format(options);
+                table_options.alter_with_string_hash_map(format_options)?;
+                table_options.output_format()
+            }
+        };
+
+        Ok(self.default_from_output_format(options))
+    }
+
+    fn default_from_output_format(&self, options: OutputFormat) -> Arc<dyn 
FileFormat>;
+
+    fn options(&self) -> (Option<OutputFormat>, ConfigFileType);

Review Comment:
   Yeah, this confuses me now too. Having ConfigFileType and OutputFormat at 
the same time is also a bit weird. I'll take a second look at this part



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to