Repository navigation
Push PromQL label matchers into the "one" side of binary operators - #128177
valerypetrov wants to merge 7 commits into
Conversation
Since ClickHouse#124879 a binary operator checks duplicate series only in matched groups, so the "one" side can be filtered like the other side. A side is filtered only if the other side can't fail, because the JOIN can skip a side when the other one is empty, and this hid errors of `and`, `group_right` and aggregations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [78cf82d] Summary: ✅
AI ReviewSummaryThe PR extends PromQL label matcher pushdown to the “one” operand of binary operators and prevents empty join inputs from hiding duplicate-series exceptions. No unresolved findings remain; both previous review points are addressed in the current code. The focused regression coverage and reported before/after measurements support the change. Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units8 translation units recompiled, 14 s compile time in total, 8 of them have a recent master baseline. |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…description Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…-side Co-Authored-By: Claude Opus 5.5 <[email protected]>
PromQL Compliance ReportBaseline: S3 master
Extended support (upstream engine tests): native-histogram exclusions: 149; excluded assertions: 248; upstream Note: Prometheus compliance score is unchanged vs baseline. |
This PR lets the PromQL label matcher pushdown also filter the "one" side of a binary operator (the right side, or the left side with
group_right), sorate(a{instance="x"}[5m]) / on(instance, cpu) rate(b[5m])now reads only the series ofbwithinstance="x". Since #124879 duplicate series are checked only in matched groups, so dropping the other groups changes no result or error. A side is now filtered only if the other side can't fail by itself, because the JOIN doesn't read the other side when one side is empty: before this PRrate({__name__=~"a|b"}[1m]) and on(x) creturned an empty result instead of the duplicate-series error that Prometheus andpromql_push_down_label_matchers = 0give.On a 10-core Mac mini with a 19,800-series dataset (6 h, 15 s, default bucketed layout), medians of 7 interleaved runs against a master build:
rate(node_cpu_seconds_total{instance="host-001:9100", mode="user"}[5m]) / ignoring(mode) group_left sum without (mode) (rate(node_cpu_seconds_total[5m]))over 1 h takes 140 -> 60 ms (memory 137 -> 17 MB),rate(node_cpu_seconds_total{instance="host-001:9100"}[5m]) / on(instance, cpu, mode) rate(node_cpu_seconds_total[5m] offset 1h)131 -> 45 ms, and a matcher keeping 75% of the series or nothing to copy stays the same.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
PromQL: label matchers are now also copied into the "one" side of a binary operator, so
a{instance="x"} / on(instance) breads only the series ofbwithinstance="x". The pushdown no longer turns an error of one side into an empty result.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/128177]