Skip to content

Add FileStreamBuilder for creating FileStreams#21261

Open
alamb wants to merge 8 commits intoapache:mainfrom
alamb:alamb/file_stream_builder
Open

Add FileStreamBuilder for creating FileStreams#21261
alamb wants to merge 8 commits intoapache:mainfrom
alamb:alamb/file_stream_builder

Conversation

@alamb
Copy link
Copy Markdown
Contributor

@alamb alamb commented Mar 30, 2026

Which issue does this PR close?

Rationale for this change

@Dandandan and I are in the process of significantly reworking how FileStream works internally (morsels!)

To support this, I want to get the code ready for a reorganization and minimize the diffs

What changes are included in this PR?

  1. Add FileStreamBuilder
  2. Deprecate FileStream::new
  3. Promote file_stream to a module

Are these changes tested?

Yes by existing CI.

Are there any user-facing changes?

Certain user facing API code that uses FileStream will need to use FileStreamBuilder rather than directly construct a FileStream

@github-actions github-actions bot added core Core DataFusion crate datasource Changes to the datasource crate labels Mar 30, 2026
@alamb alamb marked this pull request as ready for review March 30, 2026 23:32
let mut stream =
FileStream::new(&scan_config, 0, opener, &ExecutionPlanMetricsSet::new())?;
let metrics = ExecutionPlanMetricsSet::new();
let mut stream = FileStreamBuilder::new(&scan_config)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this illustrates the new API pretty well -- instead of a pile of arguments to FileStream::new there is now FileStreamBuilder

let file_stream =
FileStream::new(&config, 0, Arc::new(self.opener), &metrics_set)
.unwrap()
.with_on_error(on_error);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileStream was already starting to grow a builder interface as it gained features, so let's just make it directly

@alamb alamb mentioned this pull request Mar 31, 2026
4 tasks
Copy link
Copy Markdown
Contributor

@adriangb adriangb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate datasource Changes to the datasource crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants