From ac01dc90352ce6dfd30fc6e864e2042861a75519 Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 16 Sep 2024 11:38:35 +0200 Subject: [PATCH] Explain, vector-to-vector: Do not compute results for set operators Set operators are not displayed: https://github.com/prometheus/prometheus/blob/31ce9dacf4a3714898e8620b09a753e16e2cf32a/web/ui/mantine-ui/src/pages/query/ExplainViews/BinaryExpr/VectorVector.tsx#L364 Therefore, do not compute results for them. Fixes #14889 Signed-off-by: Julien --- web/ui/mantine-ui/src/promql/binOp.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/ui/mantine-ui/src/promql/binOp.ts b/web/ui/mantine-ui/src/promql/binOp.ts index 17b52ac1e..525f543ad 100644 --- a/web/ui/mantine-ui/src/promql/binOp.ts +++ b/web/ui/mantine-ui/src/promql/binOp.ts @@ -8,7 +8,7 @@ import { vectorMatchCardinality, VectorMatching, } from "./ast"; -import { isComparisonOperator } from "./utils"; +import { isComparisonOperator, isSetOperator } from "./utils"; // We use a special (otherwise invalid) sample value to indicate that // a sample has been filtered away by a comparison operator. @@ -340,6 +340,11 @@ export const computeVectorVectorBinOp = ( // Annotate the match groups with errors (if any) and populate the results. Object.values(groups).forEach((mg) => { + // Do not populate results for set operators. + if (isSetOperator(op)) { + return; + } + if (matching.card === vectorMatchCardinality.oneToOne) { if (mg.lhs.length > 1 && mg.rhs.length > 1) { mg.error = { type: MatchErrorType.multipleMatchesOnBothSides };