Repository navigation
feat(pyo3-arrow): Accept a single column name in Table.drop_columns - #571
Merged
Merged
Conversation
pyarrow's Table.drop_columns takes a str or a list of str; ours raised TypeError for a str. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
enabled auto-merge (squash)
October 29, 2026 15:37
datapointchris
added a commit
to datapointchris/doppeldata
that referenced
this pull request
Nov 2, 2026
`cargo audit` fails on main. Every arrow-rs 59 crate requires zstd 0.13.
zstd 0.13 with zstd-safe 7 carries
RUSTSEC-2026-0391, RUSTSEC-2026-0398 and RUSTSEC-2026-0403. A file in
`crates/.cargo/` ignored all three until the
crates could reach arrow 60, whose zstd 0.14 and zstd-safe 8 fix them.
pyo3-arrow held the workspace on arrow 59,
because its latest crates.io release builds on it.
This moves arrow and parquet to 60.1 and zstd to 0.14, and deletes the
ignore file. pyo3-arrow comes from a pinned
commit of arro3's main branch. At that commit it requires arrow 60.1 and
pyo3 0.30, and it is not yet released.
Session: 1c7b885a-84ba-42d1-9eb8-bca920ebfabf
## What to look at
- `crates/python/Cargo.toml`: the git pin on pyo3-arrow. Check the rev
is the arro3 commit to trust until a crates.io
release requires arrow 60.
- `crates/Cargo.lock`: zstd 0.14.3 and zstd-safe 8.2.0 should be the
only versions, with no arrow 59 crate left. atoi
3 and comfy-table 8 arrive through arrow 60.
- `crates/core/Cargo.toml`: the comment now says pyo3-arrow's arrow
major is read from the pinned commit's manifest.
`cargo info pyo3-arrow` reports the crates.io release, which is still on
arrow 59.
## How it was verified
- `cargo audit` 0.22.2 from `crates/`, as CI runs it: exit 0, no
advisory, 322 crates scanned.
- `cargo tree -i zstd` from `crates/`: zstd v0.14.3 alone.
- `cargo test` in `crates/`: 13 passed, 1 ignored. The determinism
contract's six pins pass at stream version 18.
- pytest over `library/tests` and `cli/tests`: 92 passed.
- `task lint` and `task check-generated`: both exit 0. The extension's
stub is unchanged.
- Bytes: the every-column-kind fixture at 70,000 rows, seed 7 and one
thread, written by the extension built on the
base commit and on this one. JSON and NDJSON files, uncompressed, gzip
and zstd, are byte-identical. Parquet and
Arrow IPC files differ. Read back, their tables are equal with their
schema and metadata.
- `spark-parity/check-spark-parity.sh` on `apache/spark:4.1.3-python3`,
with a manylinux2014 wheel built from this
branch, at 1,000,000 rows and 100,000 rows per file: all 14 checks
identical. They cover `generate` and `write` at 7
and 40 partitions, the column types, the bundle and `to_spark`. The
Arrow C stream `mapInArrow` reads crosses from
arrow-rs 60 to Spark's Arrow Java there.
## What changes
- **pyarrow 26 reads no bounds for a Parquet file's float columns.**
parquet 60 declares IEEE 754 total order on
every FLOAT and DOUBLE column. It writes their bounds only as
`min_value` and `max_value`. pyarrow 26 then reports
no min or max for those columns, and keeps every row group on a float
predicate. On the fixture,
`split_by_row_group(ds.field('fit_norm') > 1000)` keeps 1 row group,
where the arrow 59 file kept 0. DuckDB 2.0
still reads the bounds and prunes. parquet 60 has no writer setting to
declare the older order. Statistics on every
other type are unchanged.
- **Arrow IPC files are smaller.** arrow-ipc 60 pads a record batch's
buffers differently. Each of the fixture's two
batch bodies is 7,232 bytes shorter, under zstd and lz4 alike. The
schema message, the values and the compression
are unchanged.
- **Values hold.** The stream version stays 18. A dataset's identity and
its file names do not move.
- **`regenerate()` names every Parquet and Arrow file written before
this as moved**, as it does after any encoder
upgrade. The values it regenerates are the same.
- **pyo3-arrow's Python classes changed between 0.20.0 and the pinned
commit. None of the changes reaches
doppeldata's own code.** The extension builds only a `Table`, from
`generate` and `sample`, and a
`RecordBatchReader`, from `stream`. It takes no Array or ChunkedArray
from Python. So the input cast
(kylebarron/arro3#570) and the `ChunkedArray([])` ValueError
(kylebarron/arro3#569) never run. The library hands
both objects to pyarrow or Polars through `__arrow_c_stream__`. That
export path changed only to follow arrow 60's
API.
- **A caller using the returned table's own methods sees two changes.**
`Table.drop_columns` takes a single name
(kylebarron/arro3#571), and `Array.buffer` is gone
(kylebarron/arro3#568). The engine generates no interval column,
so interval scalars converting to Python objects (kylebarron/arro3#549)
reach no doppeldata output.
## Decisions, and what they rejected
- **pyo3-arrow from a git commit** — it rejected waiting for a
pyo3-arrow release on arrow 60. Nothing dates one,
and the three advisories stayed ignored meanwhile.
- **Smallest change that would work** — this one. With only the
manifests moved, `cargo check --all-targets` and
clippy pass with no warning, so arrow 60 forces no code change.
## Risk and rollback
A revert restores the advisory ignores and arrow 59. Files written by
either build stay readable by both, and hold
the same values. Building from the sdist fetches arro3 from GitHub at
the pinned commit, where it needed only
crates.io before.
## What this does not do
- It does not move pyo3-arrow back to a crates.io release. That waits on
one requiring arrow 60.
- It does not restore pyarrow's float row-group pruning, for which
parquet 60 offers no setting.
kylebarron
added a commit
that referenced
this pull request
Nov 4, 2026
* chore: Bump pyo3-arrow to 0.21 Release with pyo3 0.30 and arrow 60.1. It's a minor bump because #551 moves to arrow 60 and #559 replaces pyo3-arrow's ArrayReader and ArrayIterator with the arrow-rs types. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(pyo3-arrow): Limit the 0.21.0 changelog to import and export changes The pyo3-arrow changelog is for crates that use pyo3-arrow to move Arrow data between Rust and Python. Changes to the arro3 Python API that lives in pyo3-arrow (#549, #568, #569, #570, #571) belong in arro3's release notes instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Table.drop_columns("a")raisedTypeError: Can't extract str to Vec. pyarrow'sTable.drop_columnstakesstr or list[str], so this accepts a single name too.It adds a
ColumnNamesinput enum (Name(String)/Names(Vec<String>)) next to the other input enums ininput.rs. The stub becomescolumns: str | Sequence[str]. Other input types still raiseTypeError, as the existing test checks.Testing
test_drop_columns_single_name, which compares against pyarrow and checks theKeyErrorfor a missing name. It fails onmainand passes here. The full Python suite passes.pyo3-arrow,cargo fmt --checkandcargo clippy --all-features --tests -D warningspass.pyo3-arrowalso passescargo check --no-default-features.pyo3-arrow'scargo testis left to CI, because its test binary can't link against uv's standalone Python on this machine.🤖 Written by Claude Code