Repository navigation
Description
Support Apache Arrow IPC Streaming over HTTP
Is your feature request related to a problem? Please describe.
Currently, flapi appears to rely primarily on JSON for data delivery. While JSON is excellent for compatibility, it becomes a significant bottleneck when working with larger datasets (e.g., 100k+ rows) or analytical workloads.
The current architecture likely involves a double-conversion penalty:
-
DuckDB (Columnar)
$\to$ Row-based memory -
Row-based memory
$\to$ JSON serialization (CPU intensive) -
Client-side: JSON Parsing
$\to$ Row-based$\to$ Dataframe (Columnar)
This results in higher CPU usage, increased latency, and larger network payloads compared to binary formats.
Describe the solution you'd like
I propose adding support for Apache Arrow IPC Streaming (application/vnd.apache.arrow.stream) over HTTP.
Since flapi is built on DuckDB (which has native Arrow support) and C++, we can achieve a "zero-copy" (or near zero-copy) path from the database engine to the network socket.
Proposed Workflow:
- Add a new content-negotiation check (e.g.,
Accept: application/vnd.apache.arrow.stream) or a URL query parameter (e.g.,?format=arrow). - Use DuckDB's C++ Arrow interface (
duckdb_query_arroworduckdb_arrow_scan) to retrieve result batches in Arrow format directly. - Stream these binary batches via the existing Crow web server using HTTP Chunked Transfer Encoding.
Describe alternatives you've considered
- CSV Output: Faster than JSON, but still requires parsing and lacks type safety (losing information on timestamps, nested types, etc.).
- Parquet Export: Good for file downloads, but not ideal for streaming/interactive API responses as it generally requires random access to write the footer.
Additional Context & Use Cases
Adding Arrow support would unlock several high-performance use cases for flapi:
-
High-Speed Python/R Clients:
Data scientists using Pandas or Polars could consume endpoints with effectively zero parsing overhead:import polars as pl # Direct read from stream df = pl.read_ipc("http://flapi-instance/customers?format=arrow")
-
"Out-of-Core" Large Exports: Streaming Arrow RecordBatches allows flapi to serve datasets larger than its own RAM (and larger than the client's RAM) by processing data in chunks rather than buffering the full JSON string.
-
Modern Frontend Visualizations: Libraries like Perspective.js, Deck.gl, and Vega support Arrow. This would allow dashboards to load millions of points instantly without locking the browser thread during JSON parsing.
Technical Feasibility DuckDB already supports zero-copy conversion to Arrow objects in C++. Combining this with crow::response streaming capabilities should make this a highly efficient addition to the codebase.
Activity
jrosskopf commentedon Jan 16, 2026
Hey @sipemu,
Great proposal — we're going to implement this.
Your analysis is spot-on. Both DuckDB (Arrow C Data Interface) and Crow (chunked transfer encoding) already have the pieces we need. flapi just has to orchestrate them. 🖤
What we're planning:
Accept: application/vnd.apache.arrow.streamor?format=arrow(IANA-registered MIME type)Challenges we're working through:
DuckDB recently added native Arrow IPC support via the arrow community extension, which validates this direction.
We'll roll this out in phases — basic streaming first, then configuration and compression, then production hardening with metrics.
Your Polars/PyArrow/Perspective.js use cases are exactly what we're targeting. Will update this issue as we progress.
Cheers,
Joachim
Add Arrow IPC streaming epic and tasks (Issue #9)
feat: Implement Apache Arrow IPC streaming over HTTP
jrosskopf commentedon Jan 19, 2026
Implementation Complete: Apache Arrow IPC Streaming over HTTP
This feature has been implemented and merged to main. Here's a summary of what was delivered:
Core Features
Accept: application/vnd.apache.arrow.streamheader and?format=arrowquery parameterAcceptheader parameters (e.g.,codec=zstd)Technical Implementation
/api/v1/_health/arrowendpointCommits
164d5d9Implement Arrow IPC streaming foundation (Phase 1-2)ff45924feat: Implement Apache Arrow IPC streaming over HTTP223933dfeat: Add LZ4 and ZSTD compression for Arrow IPC streaming880e19afeat: Add Arrow configuration schemac658d1dfeat: Add Arrow metrics and logging for observabilitya98677cfeat: Add Arrow metrics to health endpointsb90a70afix: Resolve Arrow server hang by adding Content-Length headerUsage Example
Test Coverage
Thanks @sipemu for the detailed feature request!
chore(beads): Close Arrow IPC epic and related issues
docs: surface security roadmap (Waves 0–3) for the v26.05.17 release
feat: embed:// DuckDB filesystem for SQL-side bundle reads
feat: embed:// DuckDB filesystem for SQL-side bundle reads (#54)
test: end-to-end integration tests for self-packaging round-trip
test: end-to-end integration tests for self-packaging round-trip (#56)
fix(self-packaging #62): bundled-mode HTTP serving end-to-end (#69)
feat(mcp): cursor pagination, completion wrapper, and URI-templated r…