Skip to content

Commit f181edf

Browse files
committed
engine: use a regular call
Signed-off-by: Giedrius Statkevičius <[email protected]>
1 parent d9b4f25 commit f181edf

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

engine/engine.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,7 @@ loop:
656656
}
657657
}
658658

659-
_, keepHistograms := q.resultSort.(keepHistogramsSorter)
660-
if !keepHistograms {
659+
if !q.resultSort.keepHistograms() {
661660
vector = filterFloats(vector)
662661
}
663662
sort.Slice(vector, q.resultSort.comparer(&vector))

engine/sort.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,29 @@ const (
1919
sortOrderDesc sortOrder = true
2020
)
2121

22-
type keepHistogramsSorter interface {
23-
keepHistograms()
24-
}
25-
2622
type resultSorter interface {
2723
comparer(samples *promql.Vector) func(i, j int) bool
24+
keepHistograms() bool
2825
}
2926

3027
type sortFuncResultSort struct {
3128
sortOrder sortOrder
3229
}
3330

31+
func (s sortFuncResultSort) keepHistograms() bool {
32+
return false
33+
}
34+
3435
type sortByLabelFuncResult struct {
3536
sortingLabels []string
3637

3738
sortOrder sortOrder
3839
}
3940

41+
func (s sortByLabelFuncResult) keepHistograms() bool {
42+
return false
43+
}
44+
4045
type aggregateResultSort struct {
4146
sortingLabels []string
4247
groupBy bool
@@ -47,9 +52,13 @@ type aggregateResultSort struct {
4752
type noSortResultSort struct {
4853
}
4954

50-
func (a aggregateResultSort) keepHistograms() {}
55+
func (a aggregateResultSort) keepHistograms() bool {
56+
return true
57+
}
5158

52-
func (s noSortResultSort) keepHistograms() {}
59+
func (s noSortResultSort) keepHistograms() bool {
60+
return true
61+
}
5362

5463
func extractSortingLabels(f *parser.Call) []string {
5564
args := f.Args[1:]

0 commit comments

Comments
 (0)