Skip to content

fix: create file for empty stream #16342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chenkovsky
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

file won't be created for empty dataframe

What changes are included in this PR?

create file if row number is zero

Are these changes tested?

UT

Are there any user-facing changes?

No

@github-actions github-actions bot added core Core DataFusion crate datasource Changes to the datasource crate labels Jun 9, 2025
@mmooyyii
Copy link

Maybe add same test for write_parquet and write_json? I think they should have same behavior.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @chenkovsky -- the only question I have about this PR is how it works when writing partitioned output (aka into a directory).

The only thing I think the PR needs is a test showing what happens when writing to a directory.

I am not 100% sure what the expected behavior would be in this case, and I think either one is probably reasonable.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @chenkovsky 🙏

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @chenkovsky

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.

How to write csv file to disk from a empty dataframe?
3 participants