You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clean up APIs around FileScanConfigBuilder, FileScanConfig and FileSource #15952
If we force passing file_schema into ParquetFileSource::new and such that means as a user you have to pass it into two places.
I think the real solution is to have a FileSourceBuilder trait that has build() method that accepts file_schema and produces a FileScan. Then FileScanConfigBuilder can call that? It might be too much API churn to be worth it.
One question I'm not sure about is how to go about all of this: small changes, trying to keep backwards compatibility but necessarily breaking a lot of things, or make a new parallel implementation where we try to preserve the high level APIs and then eventually deprecate / replace the current ones. It seems to be what we did last refactor and based on discussion in #17076 may be the easiest path forward.
@adriangb thank you for sharing it. I don’t have much time nowadays to iterate on the new design proposal, but once it’s in a ready state, can you please ping me for a review? These api's are very critical for us (and I’m sure for many others)
@adriangb thank you for sharing it. I don’t have much time nowadays to iterate on the new design proposal, but once it’s in a ready state, can you please ping me for a review? These api's are very critical for us (and I’m sure for many others)
This way, rather than passing the parent struct (FileScanConfig) into the child struct (FileSource) when doing file operations, we'd pass a sibling struct. And technically by extracting file_source out of FileScanConfig, the data execution flow shouldn't touch the config.
However, I'm dubious whether this refactor will do anything meaningful. We're introducing another struct to be explicit about what implements DataSource, but we haven't really done anything major to FileScanConfig.
Another approach (better): let ParquetSource, JsonSource, etc directly impl DataSource
From what I understand, prior versions had file-specific execution plans (ParquetExec, JsonExec, etc..) and the existing version was written to bridge similar functionality.
However, it seems like each file source has pretty different characteristics/implementations. Now, we have to bear this abstraction cost by maintaining a format-agnostic config (FileScanConfig) with format-specific fields like new_lines_in_values or expr_adapter_factory that is only specific to 1 file source. We also introduce various call sites throughout the FileScanConfig -> FileSource relationship that does the same thing like setting the batch size/statistics/projection.
I propose we directly implement DataSource for all structs that impl FileSource. Each format already has most of what they need to implement DataSource already! This way, we'll at least narrow down which fields are shared throughout all file sources. Note, the refactor will still allow us to do things like #17095
Activity
adriangb commentedon Aug 12, 2025
My proposal for this which I've put in some other places:
DataSourceExec/FileScanConfiginto the individualFileSourcesFileScanConfigfrom the execution pathwaybatch_sizedirectly when creating file opener #17076One question I'm not sure about is how to go about all of this: small changes, trying to keep backwards compatibility but necessarily breaking a lot of things, or make a new parallel implementation where we try to preserve the high level APIs and then eventually deprecate / replace the current ones. It seems to be what we did last refactor and based on discussion in #17076 may be the easiest path forward.
berkaysynnada commentedon Aug 12, 2025
@adriangb thank you for sharing it. I don’t have much time nowadays to iterate on the new design proposal, but once it’s in a ready state, can you please ping me for a review? These api's are very critical for us (and I’m sure for many others)
adriangb commentedon Aug 12, 2025
Yes will do
friendlymatthew commentedon Aug 12, 2025
Hi, I've been staring at
FileScanConfigfor the past day now and had some thoughts about the redesign.One approach (bad): create a new struct
FileScanover the configOne thing I tried was adding a wrapper around
FileScanConfigcalledFileScan.FileScanwould implDataSourceand look something like:This way, rather than passing the parent struct (
FileScanConfig) into the child struct (FileSource) when doing file operations, we'd pass a sibling struct. And technically by extractingfile_sourceout ofFileScanConfig, the data execution flow shouldn't touch the config.However, I'm dubious whether this refactor will do anything meaningful. We're introducing another struct to be explicit about what implements
DataSource, but we haven't really done anything major toFileScanConfig.Another approach (better): let
ParquetSource,JsonSource, etc directly implDataSourceFrom what I understand, prior versions had file-specific execution plans (
ParquetExec,JsonExec, etc..) and the existing version was written to bridge similar functionality.However, it seems like each file source has pretty different characteristics/implementations. Now, we have to bear this abstraction cost by maintaining a format-agnostic config (
FileScanConfig) with format-specific fields likenew_lines_in_valuesorexpr_adapter_factorythat is only specific to 1 file source. We also introduce various call sites throughout theFileScanConfig->FileSourcerelationship that does the same thing like setting the batch size/statistics/projection.I propose we directly implement
DataSourcefor all structs that implFileSource. Each format already has most of what they need to implementDataSourcealready! This way, we'll at least narrow down which fields are shared throughout all file sources. Note, the refactor will still allow us to do things like #17095cc @adriangb @comphead @blaginin @xudong963 @mbutrovich
adriangb commentedon Dec 31, 2025
I think this is done now