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

Method Call

runtime/vam/expr/function/under.go:18–54  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

16}
17
18func (u *Under) Call(args ...vector.Any) vector.Any {
19 vec := args[0]
20 var index []uint32
21 if view, ok := vec.(*vector.View); ok {
22 vec, index = view.Any, view.Index
23 }
24 var out vector.Any
25 switch vec := vec.(type) {
26 case *vector.Const:
27 val := vector.ValueAt(nil, vec, 0)
28 val = u.samunder.Call([]super.Value{val})
29 out = vector.NewConstFromValue(val, vec.Len())
30 case *vector.Named:
31 out = vec.Any
32 case *vector.Error:
33 out = vec.Vals
34 case *vector.Union:
35 return vec.Dynamic
36 case *vector.TypeValue:
37 typs := vector.NewTypeValueEmpty(0)
38 for i := range vec.Len() {
39 t, err := u.sctx.LookupByValue(vec.Value(i))
40 if err != nil {
41 panic(err)
42 }
43 v := u.sctx.LookupTypeValue(super.TypeUnder(t))
44 typs.Append(v.Bytes())
45 }
46 out = typs
47 default:
48 return args[0]
49 }
50 if index != nil {
51 return vector.Pick(out, index)
52 }
53 return out
54}

Callers

nothing calls this directly

Calls 12

ValueAtFunction · 0.92
NewConstFromValueFunction · 0.92
NewTypeValueEmptyFunction · 0.92
TypeUnderFunction · 0.92
PickFunction · 0.92
LookupByValueMethod · 0.80
LookupTypeValueMethod · 0.80
CallMethod · 0.65
LenMethod · 0.65
ValueMethod · 0.45
AppendMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected