Apply channels.filters at read time (#103) - #104
Merged
Merged
Conversation
Wire per-table equality filters into `_prepare_channels_join` so the channels table is filtered after `column_name_mapping` and before the UDF-column projection. Update configuration docs to list `channels` as a filters-supported table and clarify filter value coercion. Add end-to-end unit tests covering string, non-matching, and boolean channel filters.
Add a QueryEngine validator that blocks `channels.filters` entries targeting the `is_plausible` column when `data_type=RAW`, since those filters run before raw encoding and bridge intervals across dropped implausible samples. Direct users to `drop_implausible_data=True` instead. Update configuration docs with the new internal columns and a caution callout. Add unit tests covering mapped plausibility columns, non-plausibility filters, and RLE mode.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
==========================================
+ Coverage 89.78% 89.80% +0.02%
==========================================
Files 62 62
Lines 5717 5740 +23
Branches 716 722 +6
==========================================
+ Hits 5133 5155 +22
Misses 463 463
- Partials 121 122 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…mode Add a QueryEngine validator that emits a `UserWarning` when `channels.filters` contains any non-plausibility column in RAW mode, since such filters run before raw encoding and bridge intervals across dropped samples. Only whole-channel scoping is safe; per-sample cleaning should use `drop_implausible_data`. Update configuration docs to clarify intended scope and adjust tests to assert the warning.
Document that RLE mode does not share RAW mode's restriction on `channels.filters`: because the channels table is already encoded, filters drop matching `[tstart, tend)` interval rows without bridging across samples and may target any column.
…ter rejection in SolverConfig Move the invariant that rejects `channels.filters` on the plausibility column in RAW mode into `SolverConfig.reject_implausible_channels_filter_in_raw()` and call it from both the reporting `QueryEngine` validator and `DefaultSolver` construction. This ensures direct query-engine use cannot bypass the guard. Add unit tests verifying the rejection in RAW mode and allowance outside it.
…lidator warning stacklevel Document that `channels.filters` in RAW mode run before raw encoding and should only be used for whole-channel scoping; `is_plausible` filters are rejected and others warn. Fix the `UserWarning` stacklevel inside the Pydantic model_validator so the warning points at the validator call rather than Pydantic internals.
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.
Summary
SolverConfig.channelsaccepted afiltersdict but the engine never applied it, so channel-table filters were silently dropped. This wires them up and adds a guardrail against the one way the feature can be misused.Changes
channels.filtersinDefaultSolver._prepare_channels_join, aftercolumn_name_mappingand before the UDF-column projection, using the same equality-filter mechanism ascontainer_tags,container_metrics, andchannel_mapping. Applying it before the projection lets a filter reference any channels column, including dimension columns the solve step drops.data_type = RAWandchannels.filterstargetsis_plausible. Such a filter runs before raw encoding and would bridge intervals across dropped samples;drop_implausible_datais the correct tool (it drops inside the encoder, so boundaries stay correct). The check keys off the internalis_plausiblename, so it also catches a physical column mapped to it."true"/"false"), added the previously undocumentedis_plausibleandtimestampinternal names to the mapping table, and added a RAW-mode caveat. Also corrected a stale "RAW to RLE" error string to "RAW to interval" (the drop works for both raw encoders).Test Plan
Checklist