Skip to content

Commit 6244c2a

Browse files
authored
vam: Support NullScan (#5613)
1 parent b257dd7 commit 6244c2a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

compiler/kernel/vop.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ func (b *Builder) compileVamLeaf(o dag.Op, parent vector.Puller) (vector.Puller,
202202
return vamop.NewFilter(b.zctx(), parent, e), nil
203203
case *dag.Head:
204204
return vamop.NewHead(parent, o.Count), nil
205+
case *dag.NullScan:
206+
return vam.NewDematerializer(zbuf.NewPuller(zbuf.NewArray([]super.Value{super.Null}))), nil
207+
205208
case *dag.Output:
206209
b.channels[o.Name] = append(b.channels[o.Name], vam.NewMaterializer(parent))
207210
return parent, nil

vector/any.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,20 @@ type Promotable interface {
2020
type Puller interface {
2121
Pull(done bool) (Any, error)
2222
}
23+
24+
type puller struct {
25+
vecs []Any
26+
}
27+
28+
func NewPuller(vecs ...Any) Puller {
29+
return &puller{vecs}
30+
}
31+
32+
func (p *puller) Pull(_ bool) (Any, error) {
33+
if len(p.vecs) == 0 {
34+
return nil, nil
35+
}
36+
vec := p.vecs[0]
37+
p.vecs = p.vecs[1:]
38+
return vec, nil
39+
}

0 commit comments

Comments
 (0)