MCPcopy
hub / github.com/lindb/lindb / funcCall

Method funcCall

aggregation/expression.go:188–210  ·  view source on GitHub ↗

funcCall calls the function

(expr *stmt.CallExpr)

Source from the content-addressed store, hash-verified

186
187// funcCall calls the function
188func (e *expression) funcCall(expr *stmt.CallExpr) []*collections.FloatArray {
189 var params []*collections.FloatArray
190 for _, param := range expr.Params {
191 paramValues := e.eval(expr, param)
192 if len(paramValues) == 0 {
193 return nil
194 }
195 params = append(params, paramValues...)
196 }
197 var result *collections.FloatArray
198 switch expr.FuncType {
199 case function.Avg:
200 result = function.AvgCall(params...)
201 case function.Rate:
202 result = function.RateCall(e.interval, params...)
203 default:
204 result = function.FuncCall(expr.FuncType, params...)
205 }
206 if result == nil {
207 return nil
208 }
209 return []*collections.FloatArray{result}
210}
211
212// binaryEval evaluates binary operator
213func (e *expression) binaryEval(expr *stmt.BinaryExpr) []*collections.FloatArray {

Callers 1

evalMethod · 0.95

Calls 4

evalMethod · 0.95
AvgCallFunction · 0.92
RateCallFunction · 0.92
FuncCallFunction · 0.92

Tested by

no test coverage detected