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

Method Call

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

Source from the content-addressed store, hash-verified

226}
227
228func (s *Sqrt) Call(args ...vector.Any) vector.Any {
229 if vec, ok := expr.CheckForNullThenError(args); ok {
230 return vec
231 }
232 vec := vector.Under(args[0])
233 if !super.IsNumber(vec.Type().ID()) {
234 return vector.NewWrappedError(s.sctx, "sqrt: number argument required", vec)
235 }
236 vec = cast.To(s.sctx, vec, super.TypeFloat64)
237 vals := make([]float64, vec.Len())
238 for i := range vec.Len() {
239 v := vector.FloatValue(vec, i)
240 vals[i] = math.Sqrt(v)
241 }
242 return vector.NewFloat(super.TypeFloat64, vals)
243}

Callers

nothing calls this directly

Calls 10

CheckForNullThenErrorFunction · 0.92
UnderFunction · 0.92
IsNumberFunction · 0.92
NewWrappedErrorFunction · 0.92
ToFunction · 0.92
FloatValueFunction · 0.92
NewFloatFunction · 0.92
IDMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected