thanos-io / promql-engine

Multi-threaded PromQL engine implementation based on the Volcano paper.
Apache License 2.0
141 stars 54 forks source link

Fix distributing constant-side binary operations #465

Closed fpetkovski closed 3 months ago

fpetkovski commented 3 months ago

Binary operations are distributed if one side is a constant expression. This only applies for scalars and not for constant series because series need to be matched on labels.

This commit makes that distinction by introducing a IsConstantScalarExpr function and using it in the distributed optimizer.

fpetkovski commented 3 months ago

It turns out the problem was distributing vector(1) and similar constant series. I've updated the PR description, PTAL again.