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

Method Call

runtime/vam/expr/function/types.go:89–115  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

87}
88
89func (i *Is) Call(args ...vector.Any) vector.Any {
90 vec := args[0]
91 typeVal := args[1]
92 if len(args) == 3 {
93 vec = args[1]
94 typeVal = args[2]
95 }
96 if typeVal.Type().ID() != super.IDType {
97 return vector.NewWrappedError(i.sctx, "is: type value argument expected", typeVal)
98 }
99 if _, ok := typeVal.(*vector.Const); ok {
100 b := vector.TypeValueValue(typeVal, 0)
101 typ, err := i.sctx.LookupByValue(b)
102 v := err == nil && typ == vec.Type()
103 return vector.NewConstBool(v, vec.Len())
104 }
105 inTyp := vec.Type()
106 out := vector.NewFalse(vec.Len())
107 for k := range vec.Len() {
108 b := vector.TypeValueValue(typeVal, k)
109 typ, err := i.sctx.LookupByValue(b)
110 if err == nil && typ == inTyp {
111 out.Set(k)
112 }
113 }
114 return out
115}
116
117type IsErr struct{}
118

Callers

nothing calls this directly

Calls 9

NewWrappedErrorFunction · 0.92
TypeValueValueFunction · 0.92
NewConstBoolFunction · 0.92
NewFalseFunction · 0.92
LookupByValueMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected