Skip to content
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

impl std::fmt::Write for StringViewBuilder / BinaryViewBuilder #6777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Nov 22, 2024

Which issue does this PR close?

Closes #6373

Rationale for this change

@tlm365 is trying to implement cast from various types to StringView efficiently in

Also, DataFusion had several places where it would like to write to a StringViewBuilder using standard rust formatting such as write!

What changes are included in this PR?

  1. impl std::fmt::Write for StringViewBuilder / BinaryViewBuilder
  2. Tests + documentation

Open questions / follow on PRs:

  1. Should I implement the same sort of "finish the row on drop" style API for StringBuilder

Are there any user-facing changes?

Yes, new APIs + docs

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 22, 2024
@alamb alamb marked this pull request as ready for review November 22, 2024 22:38
@tustvold
Copy link
Contributor

I think this will perform identically to just writing to a temporary String manually?

I wonder if we could do something a bit more sophisticated, but then again perhaps it won't make a difference.

I like the Drop based flush, although it does introduce a bit of API inconsistency...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement std::fmt::Write for StringViewBuilder to permit non contiguous data to be written
2 participants