From 710dbb74c9c9e0f826b254418aaafd596f8824cc Mon Sep 17 00:00:00 2001 From: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> Date: Wed, 3 Jun 2026 15:31:04 +0200 Subject: [PATCH] promql/parser: fix symmetric fill detection to compare values not pointers Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> --- promql/parser/printer.go | 2 +- promql/parser/printer_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/promql/parser/printer.go b/promql/parser/printer.go index e81e4ca7b2..703dd095d4 100644 --- a/promql/parser/printer.go +++ b/promql/parser/printer.go @@ -174,7 +174,7 @@ func (node *BinaryExpr) getMatchingStr() string { } if vm.FillValues.LHS != nil || vm.FillValues.RHS != nil { - if vm.FillValues.LHS == vm.FillValues.RHS { + if vm.FillValues.LHS != nil && vm.FillValues.RHS != nil && *vm.FillValues.LHS == *vm.FillValues.RHS { matching += fmt.Sprintf(" fill (%v)", *vm.FillValues.LHS) } else { if vm.FillValues.LHS != nil { diff --git a/promql/parser/printer_test.go b/promql/parser/printer_test.go index 786109ab9d..8be35d9a48 100644 --- a/promql/parser/printer_test.go +++ b/promql/parser/printer_test.go @@ -130,6 +130,10 @@ func TestExprString(t *testing.T) { in: `a + fill_left(-23) fill_right(42) b`, out: `a + fill_left (-23) fill_right (42) b`, }, + { + in: `a + fill_left(5) fill_right(5) b`, + out: `a + fill (5) b`, + }, { in: `a + on(b) group_left fill(-23) c`, out: `a + on (b) group_left () fill (-23) c`,