Skip to content

fix(python): support Polars 2 - #10398

Draft
robert3005 wants to merge 1 commit into
developfrom
rk/polars-2
Draft

robert3005 wants to merge 1 commit into
developfrom
rk/polars-2

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

Summary

Polars 2.0.0 is out, and the polars>=1.31.0 extra has no upper bound, so users already get it. With Polars 2, every VortexFile.to_polars() scan fails at collect time:

TypeError: DataFrame._from_arrow() got an unexpected keyword argument 'rechunk'

to_polars() called the private pl.DataFrame._from_arrow(batch, rechunk=False), and Polars 2 removed that keyword.

Changes

  • vortex-python/python/vortex/file.py: build each batch, and the trailing empty batch, with the public pl.DataFrame(record_batch) constructor. It works on both Polars 1.x and 2.x and is typed as DataFrame. pl.from_arrow would return DataFrame | Series.
  • Bump the polars dev dependency to >=2.0.0 and relock (polars / polars-runtime-32 1.34.0 → 2.0.0), so CI tests against Polars 2.
  • The user-facing polars>=1.31.0 extra is unchanged.

The serialized expression format that vortex.polars_ parses for predicate pushdown is the same in 2.0. All expression-translation and pushdown tests pass unchanged.

Checks run

  • uv run --all-packages pytest vortex-python/test on Polars 2.0.0: 409 passed, 2 skipped, 1 xfailed. Before the fix, 5 to_polars tests failed with the error above.
  • uvx ruff check, uvx ruff format --check, uvx ty check vortex-python vortex-python-cuda vortex-ffi/cmake/tests scripts/tests: clean.
  • test_polars_.py on Polars 1.31.0 (the extra's floor): same 4 failures as on develop, so nothing new. They are pre-existing: 1.31 serializes scalars as {"dtype": ..., "value": ...}, which polars_to_vortex doesn't parse. This means the >=1.31.0 floor is already too low for predicate pushdown. I've left that for a follow-up rather than widening this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E92wUoS3LaqWVJmmS7vKVq


Generated by Claude Code

Polars 2 removed the `rechunk` keyword from the private
`DataFrame._from_arrow`, which broke every `VortexFile.to_polars()` scan.
Build each batch with the public `pl.DataFrame` constructor instead, which
behaves the same on Polars 1.x and 2.x. Bump the dev dependency so the
test suite runs against Polars 2.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E92wUoS3LaqWVJmmS7vKVq
@robert3005 robert3005 added the changelog/fix A bug fix label Oct 8, 2026 — with Claude
@codspeed

codspeed Bot commented Oct 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 11.75%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 2 benchmarks measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. These results are not comparable, so they count as unchanged.

Preventing compiler optimizations

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 2 regressed benchmarks
✅ 2173 untouched benchmarks
⏩ 534 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime scalar_subtract_neon 10.7 µs 12.2 µs -12.17%
❌ WallTime bitpack_blocked_compress_avx2 6.7 µs 7.6 µs -11.34%
⚠️ Simulation bench_compare_primitive[(10000, 2)] 64.2 µs < 1 ns N/A
⚠️ Simulation density_sweep_dense_runs[0.9] < 1 ns < 1 ns N/A

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/polars-2 (94fb980) with develop (881b867)

Open in CodSpeed

Footnotes

  1. 534 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@robert3005
robert3005 marked this pull request as draft October 8, 2026 18:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants