Merge pull request #18851 from roidelapluie/roidelapluie/fix-fill-printer

promql/parser: fix symmetric fill detection to compare values not pointers
This commit is contained in:
Julien 2026-06-04 16:28:27 +02:00 committed by GitHub
commit 5d90fd1dda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -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 {

View file

@ -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`,