Skip to content

feat(pyo3-arrow): Accept a single column name in Table.drop_columns - #571

Merged
kylebarron merged 1 commit into
mainfrom
kyle/drop-columns-str
Oct 29, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/drop-columns-str

Conversation

@kylebarron

Copy link
Copy Markdown
Owner

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

Table.drop_columns("a") raised TypeError: Can't extract str to Vec. pyarrow's Table.drop_columns takes str or list[str], so this accepts a single name too.

It adds a ColumnNames input enum (Name(String) / Names(Vec<String>)) next to the other input enums in input.rs. The stub becomes columns: str | Sequence[str]. Other input types still raise TypeError, as the existing test checks.

Testing

  • Added test_drop_columns_single_name, which compares against pyarrow and checks the KeyError for a missing name. It fails on main and passes here. The full Python suite passes.
  • For both the workspace and pyo3-arrow, cargo fmt --check and cargo clippy --all-features --tests -D warnings pass. pyo3-arrow also passes cargo check --no-default-features. pyo3-arrow's cargo test is left to CI, because its test binary can't link against uv's standalone Python on this machine.

🤖 Written by Claude Code

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]>
@github-actions github-actions Bot added the feat label Oct 29, 2026

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@kylebarron
kylebarron enabled auto-merge (squash) October 29, 2026 15:37
@kylebarron
kylebarron merged commit 43ad494 into main Oct 29, 2026
22 checks passed
@kylebarron
kylebarron deleted the kyle/drop-columns-str branch October 29, 2026 15:41
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
…nges

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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant