MCPcopy Create free account
hub / github.com/brimdata/super / Call

Method Call

runtime/vam/expr/function/math.go:205–222  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

203}
204
205func (r *Round) Call(args ...vector.Any) vector.Any {
206 if vec, ok := expr.CheckForNullThenError(args); ok {
207 return vec
208 }
209 vec := args[0]
210 switch id := vec.Type().ID(); {
211 case super.IsFloat(id):
212 vals := make([]float64, vec.Len())
213 for i := range vec.Len() {
214 v := vector.FloatValue(vec, i)
215 vals[i] = math.Round(v)
216 }
217 return vector.NewFloat(vec.Type(), vals)
218 case super.IsNumber(id):
219 return vec
220 }
221 return vector.NewWrappedError(r.sctx, "round: not a number", vec)
222}
223
224type Sqrt struct {
225 sctx *super.Context

Callers

nothing calls this directly

Calls 9

CheckForNullThenErrorFunction · 0.92
IsFloatFunction · 0.92
FloatValueFunction · 0.92
NewFloatFunction · 0.92
IsNumberFunction · 0.92
NewWrappedErrorFunction · 0.92
IDMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected