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

Method Call

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

Source from the content-addressed store, hash-verified

14}
15
16func (c *Concat) Call(args ...vector.Any) vector.Any {
17 n := args[0].Len()
18 vecs := args[:0]
19 for _, vec := range args {
20 switch vec.Kind() {
21 case vector.KindString:
22 vecs = append(vecs, vec)
23 case vector.KindNull:
24 // Ignored.
25 case vector.KindError:
26 return vec
27 default:
28 return vector.NewWrappedError(c.sctx, "concat: string arg required", vec)
29 }
30 }
31 if len(vecs) == 0 {
32 return vector.NewConstString("", n)
33 }
34 out := vector.NewStringEmpty(0)
35 for i := range n {
36 var b strings.Builder
37 for _, vec := range vecs {
38 s := vector.StringValue(vec, i)
39 b.WriteString(s)
40 }
41 out.Append(b.String())
42 }
43 return out
44}
45
46type Join struct {
47 sctx *super.Context

Callers

nothing calls this directly

Calls 8

NewWrappedErrorFunction · 0.92
NewConstStringFunction · 0.92
NewStringEmptyFunction · 0.92
StringValueFunction · 0.92
LenMethod · 0.65
KindMethod · 0.65
StringMethod · 0.65
AppendMethod · 0.45

Tested by

no test coverage detected