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

Method Eval

runtime/sam/expr/eval.go:136–169  ·  view source on GitHub ↗
(this super.Value)

Source from the content-addressed store, hash-verified

134}
135
136func (i *In) Eval(this super.Value) super.Value {
137 elem := i.elem.Eval(this).Deunion()
138 if elem.IsError() {
139 return elem
140 }
141 if elem.IsNull() {
142 return super.Null
143 }
144 container := i.container.Eval(this)
145 if container.IsError() {
146 return container
147 }
148 var hasnull bool
149 err := container.Walk(func(typ super.Type, body scode.Bytes) error {
150 if super.TypeUnder(typ) == super.TypeNull {
151 hasnull = true
152 }
153 if coerce.Equal(elem, super.NewValue(typ, body)) {
154 return errMatch
155 }
156 return nil
157 })
158 switch err {
159 case errMatch:
160 return super.True
161 case nil:
162 if hasnull {
163 return super.Null
164 }
165 return super.False
166 default:
167 return i.sctx.NewError(err)
168 }
169}
170
171type Equal struct {
172 numeric

Callers

nothing calls this directly

Calls 9

TypeUnderFunction · 0.92
EqualFunction · 0.92
NewValueFunction · 0.92
DeunionMethod · 0.80
IsErrorMethod · 0.80
IsNullMethod · 0.80
WalkMethod · 0.80
NewErrorMethod · 0.80
EvalMethod · 0.65

Tested by

no test coverage detected