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

Method Call

runtime/vam/expr/function/string.go:91–109  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

89}
90
91func (l *Levenshtein) Call(args ...vector.Any) vector.Any {
92 if vec, ok := expr.CheckForNullThenError(args); ok {
93 return vec
94 }
95 args = underAll(args)
96 for _, a := range args {
97 if a.Type() != super.TypeString {
98 return vector.NewWrappedError(l.sctx, "levenshtein: string args required", a)
99 }
100 }
101 a, b := args[0], args[1]
102 out := vector.NewIntEmpty(super.TypeInt64, a.Len())
103 for i := uint32(0); i < a.Len(); i++ {
104 as := vector.StringValue(a, i)
105 bs := vector.StringValue(b, i)
106 out.Append(int64(levenshtein.ComputeDistance(as, bs)))
107 }
108 return out
109}
110
111type Position struct {
112 sctx *super.Context

Callers

nothing calls this directly

Calls 8

CheckForNullThenErrorFunction · 0.92
NewWrappedErrorFunction · 0.92
NewIntEmptyFunction · 0.92
StringValueFunction · 0.92
underAllFunction · 0.70
TypeMethod · 0.65
LenMethod · 0.65
AppendMethod · 0.45

Tested by

no test coverage detected