Skip to content

arrow-ipc StreamWriter better ergonomics with async #7812

Closed

Description

@gz

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I'd like to use https://docs.rs/arrow-ipc/latest/arrow_ipc/writer/struct.StreamWriter.html in an asynchronous context. I need to implement std::io::Writer for it but it would be nice if I could give it something that e.g., implements the AsyncWrite trait

Describe the solution you'd like

Constructor with trait bounds W: AsyncWrite or StreamWriterAsync struct

Activity

  1. alamb commented on Jul 25, 2025

    @alamb
    Contributor

    Note that you could also write to a buffer (Vec<u8> for example) and then send that buffer with async write

    Definitely not as ergonomic as something built in

  2. alamb commented on Jul 1, 2026

    @alamb
    Contributor

    This came up in Datafusion: apache/datafusion#23247
    I would actually like to propose a slightly different API here: a "sans IO" encoder -- specfically an encoder that does no IO

    I recommend something like the BatchCoalecer API: https://docs.rs/arrow/latest/arrow/compute/struct.BatchCoalescer.html where the output is written to buffers

    // Not there is no IO / stream:
    let mut encoder = StreamEncoder::try_new_with_options(&schema, options).unwrap();
    // Encode a batch to buffers
    writer.encode(&batch1).unwrap();
    // 
    for buffer in writer.take_buffers() {
      // bufers is Vec<Vec<u8>> that has encoded IPC data and can be
      // written to a stream, etc
    }

    I think this could be a pretty thin wrapper around https://docs.rs/arrow-ipc/latest/arrow_ipc/writer/struct.IpcDataGenerator.html

  3. Phoenix500526 commented on Jul 3, 2026

    @Phoenix500526
    Contributor

    Hi @alamb . I open a PR to add the sans-IO stream encoder. Could you take a look when you have time? Thanks.

  4. added a commit that references this issue on Jul 27, 2026
    1a46dd3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions