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

Method update

runtime/sam/expr/values.go:213–229  ·  view source on GitHub ↗

update maps the object into the receiver's vals slice while also seeing if we can reuse the cached record type. If not we look up a new type, cache it, and save the field for the cache check.

(rec map[string]fieldValue)

Source from the content-addressed store, hash-verified

211// seeing if we can reuse the cached record type. If not we look up
212// a new type, cache it, and save the field for the cache check.
213func (r *recordSpreadExpr) update(rec map[string]fieldValue) {
214 if len(r.fields) != len(rec) {
215 r.invalidate(rec)
216 return
217 }
218 for name, fv := range rec {
219 typ := fv.none
220 if typ == nil {
221 typ = fv.value.Type()
222 }
223 if r.fields[fv.index] != super.NewFieldWithOpt(name, typ, fv.opt) {
224 r.invalidate(rec)
225 return
226 }
227 r.vals[fv.index] = fv
228 }
229}
230
231func (r *recordSpreadExpr) invalidate(rec map[string]fieldValue) {
232 n := len(rec)

Callers 1

EvalMethod · 0.95

Calls 3

invalidateMethod · 0.95
NewFieldWithOptFunction · 0.92
TypeMethod · 0.65

Tested by

no test coverage detected