friendlymatthew commented on code in PR #17242:
URL: https://github.com/apache/datafusion/pull/17242#discussion_r2302046403


##########
datafusion/datasource-json/src/file_format.rs:
##########
@@ -251,16 +251,16 @@ impl FileFormat for JsonFormat {
     async fn create_physical_plan(
         &self,
         _state: &dyn Session,
-        conf: FileScanConfig,
+        source: Arc<dyn FileSource>,
     ) -> Result<Arc<dyn ExecutionPlan>> {
-        let source = Arc::new(JsonSource::new());
-        let conf = FileScanConfigBuilder::from(conf)
+        let conf = FileScanConfigBuilder::from(source.config().to_owned())
             .with_file_compression_type(FileCompressionType::from(
                 self.options.compression,
             ))
-            .with_source(source)
             .build();
-        Ok(DataSourceExec::from_data_source(conf))

Review Comment:
   FWIW, I think if we have a dedicated builder for `FileScanConfig`, we should 
use it! We could obviously do something like: 
   
   ```rs
   config.with_file_compression_type(...);
   ```
   
   But we introduce 2 different ways of doing the same thing



##########
datafusion/datasource-json/src/file_format.rs:
##########
@@ -251,16 +251,16 @@ impl FileFormat for JsonFormat {
     async fn create_physical_plan(
         &self,
         _state: &dyn Session,
-        conf: FileScanConfig,
+        source: Arc<dyn FileSource>,
     ) -> Result<Arc<dyn ExecutionPlan>> {
-        let source = Arc::new(JsonSource::new());
-        let conf = FileScanConfigBuilder::from(conf)
+        let conf = FileScanConfigBuilder::from(source.config().to_owned())
             .with_file_compression_type(FileCompressionType::from(
                 self.options.compression,
             ))
-            .with_source(source)
             .build();
-        Ok(DataSourceExec::from_data_source(conf))

Review Comment:
   FWIW, I think if we have a dedicated builder for `FileScanConfig`, we should 
use it! We could obviously do something like: 
   
   ```rs
   config.with_file_compression_type(...); // returns -> Self
   ```
   
   But we introduce 2 different ways of doing the same thing



-- 
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