Feature/metric expression array support - #77
Open
adefabian wants to merge 9 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
==========================================
+ Coverage 88.83% 88.94% +0.10%
==========================================
Files 61 61
Lines 5170 5175 +5
Branches 621 623 +2
==========================================
+ Hits 4593 4603 +10
+ Misses 466 461 -5
Partials 111 111
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
adefabian
marked this pull request as ready for review
August 12, 2026 04:58
tombonfert
reviewed
Aug 12, 2026
tombonfert
reviewed
Aug 12, 2026
tombonfert
previously approved these changes
Aug 12, 2026
tombonfert
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Please remove test 'test_metric_expression_is_spark_evaluated_not_pandas'
The SeriesCache.resolve() docstrings claimed to resolve "tags/metrics", but resolve() is only ever called from TimeSeriesSelector.build() and handles a channel selector's TagExpression — metric filters are evaluated in Spark via get_selector_expr, never through this pandas path. Corrected the wording in series_cache, blob_solver, default_solver, and empty_cache. Added tests: - metric_expression_test: guard that MetricExpression evaluates via get_selector_expr and has no build_pandas / serialization surface, so it can never reach the pandas resolve() path (the removed build_pandas stays unreachable). - metric_array_filter_test: duplicate-element handling for contains_all, numeric (array<long>) columns, and value-list snapshot semantics for contains_any/contains_all. Co-authored-by: Isaac
adefabian
force-pushed
the
feature/metric_expression_array_support
branch
from
August 13, 2026 11:46
f7145ae to
f092bc0
Compare
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
Adds array-membership filter operators to
MetricExpressionfor queryingPOI-backed metrics whose values are stored as arrays, and removes the now-unused
pandas evaluation path from metric expressions.
Changes
MetricExpression(metric_expression.py):.contains(value)— array membership (F.array_contains).contains_any([...])— non-empty intersection (OR); empty list matches nothing.contains_all([...])— superset (AND); empty list matches everythinge.g.
q.metric("poi_defect_values").contains_any(["B1024-43", "U0046-13"]).They compose with the existing scalar comparisons and
&/|, and evaluate inSpark via
get_selector_expr.build_pandasfromMetricExpression/MetricSelector/MetricOp.It was dead code for metrics — metric filters run through Spark, and the only
build_pandascallers (TimeSeriesCache.resolve) only ever receive aTagExpression.TagExpression.build_pandasis untouched.SeriesCache.resolve(and the blob/default/empty caches)said it resolves "tags/metrics"; it only ever resolves a
TimeSeriesSelector'stag expression. Corrected to say so.
Test Plan
Checklist