Repository navigation
fix(filters): PolarsFilter warns on every construction; Filter is the documented filter (ITL-1296) - #625
Conversation
… documented filter (ITL-1296) PolarsFilter passes every column through Polars and can change values (a date64 off midnight comes back at midnight). That fault is deferred. Building a PolarsFilter, and loading a saved one (rebuilt or kept read-only), now issues PolarsFilterWarning every time. Filter was probed for the same fault and is exact; the probe is kept as a test. The documentation presents Filter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Warning contract, emission, and tests src/orcapod/errors.py, src/orcapod/core/operators/filters.py, src/orcapod/pipeline/graph.py, tests/test_core/operators/test_polars_filter_warning.py, tests/**, test-specification/** |
Construction and saved-job loading emit PolarsFilterWarning, including for read-only saved nodes. Dedicated tests check warning frequency, warning locations, filtering, and error behavior. Other test modules suppress this warning. |
Filter value-preservation tests tests/test_core/operators/test_filter_exact_values.py |
New tests compare Filter outputs with kept input values across multiple Arrow types and execution paths. Additional checks confirm the comparisons detect changes from a Polars round trip. |
Warnings and user guidance .zed/rules, CLAUDE.md, README.md, changelog.d/*, docs/**, src/orcapod/core/sources/spiraldb_table_source.py, src/orcapod/types/condition.py, tests/test_docs/* |
Documentation describes PolarsFilter’s possible value changes, warning behavior, and Filter alternatives. It marks PolarsFilter as not recommended and records the decimal256 panic caveat. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Other
Possibly related PRs
- metamorphic-labs/orcapod-python#498: Updates tutorials, concept pages, and API references to explain
stream.filterandFilter, which this PR also presents as the recommended alternative toPolarsFilter.
Merge Risk: 
Minimal · up to 9e33d
-
This change warns users when they build or load a PolarsFilter and points them to Filter, which preserves values. Nothing in the supplied evidence shows a behavior regression, so it is ready to merge.
Security architecture risk: 
Minimal · up to 9e33d
-
Saved pipelines that use PolarsFilter now warn when opened and may be rejected if warnings are treated as errors. That rejection happens before a partial pipeline is returned. The warning does not fix the existing value-conversion issue; Filter remains the recommended operator.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- observed — A saved operator class name can select the new diagnostic on the existing load path. The warning body is fixed and does not interpolate the saved descriptor or row values.
Trust Boundaries and Controls
- observed — The read-only warning branch invokes the diagnostic after the existing resolver has failed to rebuild the operator. It does not turn a read-only node into an executable operator or change the job loader's requirement that database connectors be supplied by the caller.
-
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title names the fix scope (filters), the main behavior change (PolarsFilter now warns on every construction), and the documentation change (Filter is the documented filter), with the ticket reference ITL-1296. The changeset matches: PolarsFilterWarning is added and emitted on construction and load, and docs, tests, and changelog point users to Filter. The title is specific and accurate, though the 98-character length is slightly long.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
- Mode: Review on demand
- Reviewed files: 72
- Charged: $18.00
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
…ct the decimal256 text (ITL-1296) Review of PR 625. The channel comparison dropped the data half of a data-tag; rows are now compared as tag and data tables apart on every path, and tests that carry one column through Polars require every path's comparison to fail. The decimal fixtures fill their declared precision. A decimal256 column makes PolarsFilter raise pyo3's PanicException (a BaseException), not abort: the texts say so and a subprocess test pins it. Every user-doc mention of PolarsFilter says it is not recommended, checked by a docs test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What
ITL-1296:
PolarsFiltercarries every column through Polars, also the columns its predicates do not read, and changes values (adate64column[1, 86400001]ms comes out[0, 86400000]ms, with no error).Decision (developer, 2026-11-28): the value fault is deferred;
Filteris the filter for users, andPolarsFilterwarns whenever one is built. This PR does that. It does not fixPolarsFilter's values, so ITL-1296 stays open.Changes
New
PolarsFilterWarning(orcapod.errors, aUserWarning, listed in the API reference). It names the fault (thedate64case), saysPolarsFilteris not recommended, and namesFilteras the operator to use. It is issued every time, not once per process, and is shown at the user's line; Python's once-per-line rule cannot hide a repeat. The once-per-processProvisionalHashWarningis unchanged.Which routes warn (one helper,
filters.warn_polars_filter_values):PolarsFilter(...)stream.polars_filter(...)PolarsFilter.from_config(config)serialization.resolve_operator_from_config(config)PipelineJob.load/Pipeline.load, filter rebuilt from its configPolarsFilternode, at every loadPipelineJob.load/Pipeline.load, filter kept read-only (a predicate no config holds; its constructor never runs)graph.py, so loading is uniform)job.run(),job.save(),loaded.run(load_only=True)Under an error filter the construction, and the load, raise.
Filterwas checked for the same fault and is exact. The probe is kept astests/test_core/operators/test_filter_exact_values.py: adate64off midnight,time64[ns]below a microsecond, a float32 signaling NaN,-0.0,decimal128(38, 20)anddecimal256(76, 40),PathandUUIDlogical columns, strings and binaries of both widths, a list and a struct of them; each as plain tag, data and data-tag; two arrangements of the table (16 tag and 16 data columns); a condition that reads none of them, one that reads all of them, and conditions that compare their values; on the sync path, the row channel path (async_execute) and in a job run by either orchestrator. Every kept value equals the input's, bit for bit. A dictionary-encoded column is not in the probe: no stream holds one (it is refused when the source or raw stream is built).Documentation.
Filteris the filter shown. The tutorial (Part 3) no longer has apolars_filtersample: a testfiltercannot say (arithmetic between columns, a string function) is computed as a column in a function pod and filtered on. ThePolarsFiltersection ofdocs/concepts/operators.mdopens with a "Not recommended" warning; its two samples thatFiltercan express are removed, and the two about the identity of an expression predicate stay (they issue the warning when run). Other mentions that pointed users toPolarsFilternow point toFilter(docs/concepts/sources.md, thewhere()docstring,docs/troubleshooting.md, theCondition.oferror text for an argument that is not a condition).Tests.
tests/test_core/operators/test_polars_filter_warning.pyasserts the warning on every route above. The 50 test files that build aPolarsFilterfor another purpose ignore it with a per-filepytestmarkand a reason comment; one module builds its cases when collected, where no mark applies, and ignores it for that block only.pytest.iniandconftest.pyare unchanged. With-W error::orcapod.errors.PolarsFilterWarning, those files andtests/test_hashingpass.Design-issues log:
ITL-1296-PF2, statusopen(fault deferred, warning added).CLAUDE.mdand.zed/rules: one sentence on the rule. Changelog fragmentchangelog.d/ITL-1296.md.Review round 1 (finding -> test)
test_filter_exact_values.py::test_a_change_of_only_the_data_half_of_a_data_tag_is_caught(the channel writer changed to carry only the data half oft_date64through Polars: the comparison must fail, and only on the data half) and::test_a_column_carried_through_polars_is_caught_on_every_path(a filter changed on its table path and its channel path: every path's comparison must fail);::test_every_path_keeps_every_valuepasses for the realFilterPolarsFilterin the user documentationpolars_filter, and the provisional section saysPolarsFilterhas a fault of its owntests/test_docs/test_polars_filter_mentions.py(fails on the 16 blocks of the reviewed head)decimal256statement ("no caller can catch", "abort the process")pyo3_runtime.PanicException, aBaseExceptionthatexcept Exceptiondoes not catch andexcept BaseExceptiondoes; the process goes ontest_polars_filter_warning.py::test_a_decimal256_column_raises_a_panic_exception(in a subprocess)Decimalproduct rounds to 28 digits)test_filter_exact_values.py::test_the_decimal_fixtures_fill_their_precisionFilteris still exact under the stronger comparison, on every path.Not changed
PolarsFilter's rows and values, and its identity. No golden value moves (generate_golden_hashes.py --checkpasses).Checks
ruff check,ruff format --check,basedpyright(exit 0, 0 errors), the golden check, the changelog and design-issue checks, and the targeted tests (the new files, every file touched,tests/test_hashing,tests/test_docs) pass locally. The full suite is left to CI.Related: ITL-1296 (stays open), ITL-1374.
🤖 Generated with Claude Code
Summary by CodeRabbit
PolarsFilternow warns when created or loaded, including saved filters that aren’t rebuilt. The warning notes that processing columns through Polars may change values or cause errors.PolarsFilteras not recommended and updated guidance to useFilterfor row selection. Added details on possible value changes and errors, including with certain date and decimal values.