feat: apache-arrow read_arrow() function via bundled nanoarrow extension#3
Open
deem0n wants to merge 1 commit into
Open
feat: apache-arrow read_arrow() function via bundled nanoarrow extension#3deem0n wants to merge 1 commit into
deem0n wants to merge 1 commit into
Conversation
Adds first-class Apache Arrow IPC reading to pg_duckdb, mirroring the read_parquet pattern: * third_party/pg_duckdb_extensions.cmake: link paleolimbot/duckdb-nanoarrow PR duckdb#47 (commit 42e4199), which targets DuckDB 1.5. * sql/pg_duckdb--1.1.0--1.2.0.sql: register read_arrow(text) and read_arrow(text[]) as duckdb_only_function stubs. The planner reroutes any query containing these calls to DuckDB, which executes the function natively via the statically-linked nanoarrow extension. * pg_duckdb.control: bump default_version 1.1.0 -> 1.2.0. * src/pgduckdb_hooks.cpp:ContainsDuckdbRowReturningFunction(): add read_arrow to the strstr filter so the planner-routing pre-check recognises it without requiring duckdb.force_execution = true. * src/pgduckdb_metadata_cache.cpp:BuildDuckdbOnlyFunctions(): add read_arrow to the known-function list so duckdb_only_function lookups cache its OID. * test/regression/sql/arrow.sql + expected/arrow.out: round-trip both Arrow IPC stream (.arrows) and Arrow IPC file (.arrow) formats through COPY ... TO + read_arrow(). Array-variant test included. * test/regression/schedule: register the arrow test. Note: nanoarrow rejects Arrow files with Dictionary-encoded columns. A common JS producer pitfall is apache-arrow's tableFromArrays(), which auto-builds Dictionary<Int32, Utf8> for string columns. Producers should emit plain Utf8 vectors via vectorFromArray() and stream-format IPC. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds first-class Apache Arrow IPC reading to
pg_duckdb, mirroring theread_parquet()pattern.read_arrow()function is the natural complement toread_parquet()for pipelines whose producer is JavaScript/Node, for Arrow Flight handoff, for streaming columnar data, or for notebook-style PyArrow/R-Arrow exchange. Smaller audience than Parquet today, growing as the Arrow IPC wire ecosystem (Flight, ADBC, JS dashboards) matures.Adds first-class Apache Arrow IPC reading to pg_duckdb, mirroring the read_parquet pattern:
Tested against this fork's pinned DuckDB v1.5.3 on Postgres 15. The regression test runs cleanly.
Note: nanoarrow rejects Arrow files with Dictionary-encoded columns. A common JS producer pitfall is apache-arrow's tableFromArrays(), which auto-builds Dictionary<Int32, Utf8> for string columns. Producers should emit plain Utf8 vectors via vectorFromArray() and stream-format IPC.