Skip to content

GH-184: Harden Arrow C Data Interface validation#606

Draft
samtalki wants to merge 4 commits into
apache:mainfrom
samtalki:agent/cdata-hardening
Draft

GH-184: Harden Arrow C Data Interface validation#606
samtalki wants to merge 4 commits into
apache:mainfrom
samtalki:agent/cdata-hardening

Conversation

@samtalki

@samtalki samtalki commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #184

Depends on #603, #604, and #605. Do not merge before those PRs land.

Incremental review diff: samtalki/arrow-julia@agent/cdata-export...agent/cdata-hardening

This adds final C Data validation and interop hardening coverage:

  • deterministic malformed import fuzzing, with ARROW_CDATA_FUZZ_ITERS for local expansion
  • extra malformed nested import and export layout cases
  • C producer smoke test compiled with the local C compiler when available
  • repeated GC stress over exported and reimported tables
  • optional PyArrow C Data smoke test that skips when Python, PyArrow, or the C capsule API is unavailable

Verification:

  • julia --project=. -e 'using Arrow, Test, Tables, DataAPI; include("test/cdata.jl")'
  • julia --project=. --check-bounds=yes -e 'using Arrow, Test, Tables, DataAPI; include("test/cdata.jl")'
  • julia --project=. -e 'using Pkg; Pkg.test()'
  • julia --project=. -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=yes"])'
  • git diff --check upstream/main...HEAD

AI assistance: Generated with OpenAI Codex and reviewed for licensing and unsafe code concerns.

Incremental size note: relative to predecessor #605, this PR is 2 files changed, +355/-0 diff lines, net +355. GitHub may show the larger unmerged stack diff until #603, #604, and #605 land.

samtalki and others added 4 commits July 6, 2026 19:51
Add ArrowSchema and ArrowArray ABI structs plus C Data import for null and primitive arrays. Root struct arrays are exposed as Tables.jl column tables with DataAPI metadata.

Add validation for pointer layout, child counts, buffers, offset arithmetic, metadata bounds, dictionary pointer consistency, release idempotency, and reads after release.

Keep aligned imported buffers rooted behind a shared owner, and mirror arrow-rs by copying misaligned fixed width buffers into aligned storage before typed access. The copy and collect methods materialize Julia owned arrays.

Adjust dictionary encoding offsets for non 1-based reference pools so categorical pools with missing values keep correct dictionary indices.

Co-authored-by: Robert Buessow <robert.buessow@relational.ai>
Co-authored-by: Olle Martensson <olle.martensson@gmail.com>
Generated-by: OpenAI Codex
Add import support for boolean, string, binary, list, fixed size, temporal, timestamp, duration, interval, and decimal C Data formats. Extend malformed input, offset, null count, release, copy, collect, metadata, and GC rooting coverage for the broader importer.

Co-authored-by: Robert Buessow <robert.buessow@relational.ai>

Co-authored-by: Olle Martensson <olle.martensson@gmail.com>

Generated-by: OpenAI Codex
Add array and table export entry points with independent schema and array owners.

Cover primitive and struct round trips, release order, moved child ownership, GC, metadata, malformed layout, unsupported export cases, and exported buffer layout checks for nested, string, and fixed size arrays.

Co-authored-by: Robert Buessow <robert.buessow@relational.ai>
Co-authored-by: Olle Martensson <olle.martensson@gmail.com>
Generated-by: OpenAI Codex
Add deterministic malformed import fuzzing, nested malformed input and export layout checks, a C producer smoke test, repeated GC stress, and an optional PyArrow C Data smoke test with skips when the external dependency is unavailable.

Co-authored-by: Robert Buessow <robert.buessow@relational.ai>

Co-authored-by: Olle Martensson <olle.martensson@gmail.com>

Generated-by: OpenAI Codex
@samtalki samtalki force-pushed the agent/cdata-hardening branch from cb14ddf to bffab43 Compare July 7, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support C data interface

1 participant