Browse Source

[REFACTOR] PromQL: remove label_join and label_replace stubs

These functions operate on whole series, not on samples, so they do not
fit into the table of functions that return a Vector. Remove the stub
entries that were left to help downstream users of the code identify
what changed.

We cannot remove the entries from the `FunctionCalls` map without
breaking `TestFunctionList`, so put some nils in to keep it happy.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
pull/14992/head
Bryan Boreham 2 months ago
parent
commit
b8e5b7cda9
  1. 14
      promql/functions.go

14
promql/functions.go

@ -1514,11 +1514,6 @@ func (ev *evaluator) evalLabelReplace(ctx context.Context, args parser.Expressio
return matrix, ws return matrix, ws
} }
// === label_replace(Vector parser.ValueTypeVector, dst_label, replacement, src_labelname, regex parser.ValueTypeString) (Vector, Annotations) ===
func funcLabelReplace(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
panic("funcLabelReplace wrong implementation called")
}
// === Vector(s Scalar) (Vector, Annotations) === // === Vector(s Scalar) (Vector, Annotations) ===
func funcVector(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) { func funcVector(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
return append(enh.Out, return append(enh.Out,
@ -1570,11 +1565,6 @@ func (ev *evaluator) evalLabelJoin(ctx context.Context, args parser.Expressions)
return matrix, ws return matrix, ws
} }
// === label_join(vector model.ValVector, dest_labelname, separator, src_labelname...) (Vector, Annotations) ===
func funcLabelJoin(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
panic("funcLabelReplace wrong implementation called")
}
// Common code for date related functions. // Common code for date related functions.
func dateWrapper(vals []parser.Value, enh *EvalNodeHelper, f func(time.Time) float64) Vector { func dateWrapper(vals []parser.Value, enh *EvalNodeHelper, f func(time.Time) float64) Vector {
if len(vals) == 0 { if len(vals) == 0 {
@ -1696,8 +1686,8 @@ var FunctionCalls = map[string]FunctionCall{
"idelta": funcIdelta, "idelta": funcIdelta,
"increase": funcIncrease, "increase": funcIncrease,
"irate": funcIrate, "irate": funcIrate,
"label_replace": funcLabelReplace, "label_replace": nil, // evalLabelReplace not called via this map.
"label_join": funcLabelJoin, "label_join": nil, // evalLabelJoin not called via this map.
"ln": funcLn, "ln": funcLn,
"log10": funcLog10, "log10": funcLog10,
"log2": funcLog2, "log2": funcLog2,

Loading…
Cancel
Save