Skip to content

Commit

Permalink
vam: Support NullScan (#5613)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnibs authored Feb 3, 2025
1 parent b257dd7 commit 6244c2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/kernel/vop.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ func (b *Builder) compileVamLeaf(o dag.Op, parent vector.Puller) (vector.Puller,
return vamop.NewFilter(b.zctx(), parent, e), nil
case *dag.Head:
return vamop.NewHead(parent, o.Count), nil
case *dag.NullScan:
return vam.NewDematerializer(zbuf.NewPuller(zbuf.NewArray([]super.Value{super.Null}))), nil

case *dag.Output:
b.channels[o.Name] = append(b.channels[o.Name], vam.NewMaterializer(parent))
return parent, nil
Expand Down
17 changes: 17 additions & 0 deletions vector/any.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ type Promotable interface {
type Puller interface {
Pull(done bool) (Any, error)
}

type puller struct {
vecs []Any
}

func NewPuller(vecs ...Any) Puller {
return &puller{vecs}
}

func (p *puller) Pull(_ bool) (Any, error) {
if len(p.vecs) == 0 {
return nil, nil
}
vec := p.vecs[0]
p.vecs = p.vecs[1:]
return vec, nil
}

0 comments on commit 6244c2a

Please sign in to comment.