Polars backend
Verification
Scope
PolarsTable against the Table contract: joins, grouping and group order, summarise .groups, factors, list-columns, type round trips, strict mode, and DataFrame fallback for closures and rowwise operations.
References
- Versions
- PHP 8.5.10, php_polars 0.1.0
Data
- Inputs
- Tables defined in tests/Polars/.
Method
Each test runs a PolarsTable operation and compares it with the DataFrame result or a fixed expectation.
- Check
- Expected values and invariants of the package
- Recorded
- 2026-11-02, PHP 8.5.10, macOS 27.0.1 (arm64), commit 1abdeb1
Tolerances
exact equality
Applies to: Values, types, groups, and exceptions
x: package value; r: reference value.
Results
32 comparisons: 32 pass, 0 fail, 0 skipped.
| Case | Quantity | Status |
|---|---|---|
| left joins like dplyr | pass | |
| full and right joins append unmatched y rows with coalesced keys | pass | |
| keeps both key sets with keep | pass | |
| joins on differently named keys and suffixes clashes like dplyr | pass | |
| warns on an unexpected many-to-many join | pass | |
| enforces relationship and unmatched | pass | |
| handles multiple, naMatches, semi, anti and cross | pass | |
| matches 1 with 1.0 and factors with strings by label | pass | |
| keeps x grouping through joins | pass | |
| sorts groups like dplyr: NA last, factors by level | pass | |
| iterates groups in sorted order with ungrouped tables | pass | |
| runs closures by falling back to a DataFrame, keeping groups | pass | |
| takes rows by index, with null giving an NA row | pass | |
| works rowwise through the DataFrame fallback | pass | |
| throws instead of falling back in strict mode | pass | |
| keeps types and round-trips through collect | pass | |
| selects, renames, distinct, slices and counts like the contract | pass | |
| mutates with lists, scalars and later entries seeing earlier ones | pass | |
| refuses keep: false with comparisons | pass | |
| honours summarise .groups and groupBy(drop: false) | pass | |
| lists group rows in group order | pass | |
| ranks and orders factors by level, as phibble v0.1.0 does | pass | |
| creates Polars tables with polars() | pass | |
| keeps list-columns that Polars stores exactly and refuses named arrays with different keys | pass | |
| has summarize() as an alias of summarise() | pass | |
| filters with expressions per group in Polars, dropping NA | pass | |
| arranges by expressions in Polars | pass | |
| rejects summarise entries that are not size 1 | pass | |
| raises like R for quantile() over NA without na_rm | pass | |
| keeps dates as dates through Polars expressions | pass | |
| reads the clock through today() and now() in Polars | pass | |
| rejects invalid regular expressions clearly in Polars | pass |
Reproduction
From the repository root
php -d extension=php_polars.so php vendor/bin/pest tests/Polars
- Raw record
- site/verifications/polars-backend.json