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

Method Call

runtime/sam/expr/function/string.go:135–160  ·  view source on GitHub ↗
(args []super.Value)

Source from the content-addressed store, hash-verified

133}
134
135func (s *Split) Call(args []super.Value) super.Value {
136 args = underAll(args)
137 sVal, sepVal := args[0], args[1]
138 if sVal.IsNull() || sepVal.IsNull() {
139 return super.Null
140 }
141 if sVal.Type().Kind() == super.ErrorKind {
142 return sVal
143 }
144 if sepVal.Type().Kind() == super.ErrorKind {
145 return sVal
146 }
147 for i := range args {
148 if !args[i].IsString() {
149 return s.sctx.WrapError("split: string arg required", args[i])
150 }
151 }
152 str := super.DecodeString(sVal.Bytes())
153 sep := super.DecodeString(sepVal.Bytes())
154 splits := strings.Split(str, sep)
155 var b scode.Bytes
156 for _, substr := range splits {
157 b = scode.Append(b, super.EncodeString(substr))
158 }
159 return super.NewValue(s.typ, b)
160}
161
162type Join struct {
163 sctx *super.Context

Callers

nothing calls this directly

Calls 12

DecodeStringFunction · 0.92
AppendFunction · 0.92
EncodeStringFunction · 0.92
NewValueFunction · 0.92
IsNullMethod · 0.80
IsStringMethod · 0.80
WrapErrorMethod · 0.80
SplitMethod · 0.80
underAllFunction · 0.70
KindMethod · 0.65
TypeMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected