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

Method Call

runtime/vam/expr/function/parse.go:53–84  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

51}
52
53func (p *ParseSUP) Call(args ...vector.Any) vector.Any {
54 if vec, ok := expr.CheckForNullThenError(args); ok {
55 return vec
56 }
57 vec := vector.Under(args[0])
58 if vec.Type().ID() != super.IDString {
59 return vector.NewWrappedError(p.sctx, "parse_sup: string arg required", args[0])
60 }
61 var errs []uint32
62 errMsgs := vector.NewStringEmpty(0)
63 builder := vector.NewDynamicBuilder()
64 for i := range vec.Len() {
65 s := vector.StringValue(vec, i)
66 p.sr.Reset(s)
67 val, err := p.zr.Read()
68 if err != nil {
69 errs = append(errs, i)
70 errMsgs.Append("parse_sup: " + err.Error())
71 continue
72 }
73 if val == nil {
74 builder.Write(super.Null)
75 } else {
76 builder.Write(*val)
77 }
78 }
79 out := builder.Build(p.sctx)
80 if len(errs) > 0 {
81 return vector.Combine(out, errs, vector.NewVecWrappedError(p.sctx, errMsgs, vector.Pick(args[0], errs)))
82 }
83 return out
84}

Callers

nothing calls this directly

Calls 15

WriteMethod · 0.95
BuildMethod · 0.95
CheckForNullThenErrorFunction · 0.92
UnderFunction · 0.92
NewWrappedErrorFunction · 0.92
NewStringEmptyFunction · 0.92
NewDynamicBuilderFunction · 0.92
StringValueFunction · 0.92
CombineFunction · 0.92
NewVecWrappedErrorFunction · 0.92
PickFunction · 0.92
IDMethod · 0.65

Tested by

no test coverage detected