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

Method evalForList

runtime/vam/expr/logic.go:277–310  ·  view source on GitHub ↗
(lhs, rhs vector.Any, offsets, index []uint32)

Source from the content-addressed store, hash-verified

275}
276
277func (p *PredicateWalk) evalForList(lhs, rhs vector.Any, offsets, index []uint32) vector.Any {
278 n := lhs.Len()
279 var nulls, trues roaring.Bitmap
280 var lhsIndex, rhsIndex []uint32
281 for j := range n {
282 idx := j
283 if index != nil {
284 idx = index[j]
285 }
286 start, end := offsets[idx], offsets[idx+1]
287 if start == end {
288 continue
289 }
290 n := end - start
291 lhsIndex = slices.Grow(lhsIndex[:0], int(n))[:n]
292 rhsIndex = slices.Grow(rhsIndex[:0], int(n))[:n]
293 for k := range n {
294 lhsIndex[k] = j
295 rhsIndex[k] = k + start
296 }
297 lhsView := vector.Pick(lhs, lhsIndex)
298 rhsView := vector.Pick(rhs, rhsIndex)
299 vec := p.Eval(lhsView, rhsView)
300 if hasTrue(vec) {
301 trues.Add(j)
302 } else if hasNull(vec) {
303 nulls.Add(j)
304 }
305 }
306 truesVec := vector.NewFalse(n)
307 trues.WriteDenseTo(truesVec.GetBits())
308 nullsVec := vector.NewNull(n)
309 return combine(truesVec, nullsVec, nulls.ToArray())
310}
311
312func hasNull(vec vector.Any) bool {
313 var hasNull bool

Callers 1

evalMethod · 0.95

Calls 11

EvalMethod · 0.95
PickFunction · 0.92
NewFalseFunction · 0.92
NewNullFunction · 0.92
hasTrueFunction · 0.85
hasNullFunction · 0.85
GrowMethod · 0.80
GetBitsMethod · 0.80
combineFunction · 0.70
LenMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected