Skip to content

Commit

Permalink
vector.View: Do not wrap Consts in a View
Browse files Browse the repository at this point in the history
The commit changes the behavior when attempting to wrap a view over a
const. We instead resize the Const to the index size and rebuild the
null Boolean vector if it is not null.
  • Loading branch information
mattnibs committed Oct 1, 2024
1 parent 402bd93 commit 3c758ee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vector/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ var _ Any = (*View)(nil)

func NewView(index []uint32, val Any) Any {
switch val := val.(type) {
case *Const:
var nulls *Bool
if val.Nulls != nil {
nulls = NewBoolEmpty(uint32(len(index)), nil)
for k, slot := range index {
if val.Nulls.Value(slot) {
nulls.Set(uint32(k))
}
}
}
return NewConst(val.val, uint32(len(index)), nulls)
case *Dict:
index2 := make([]byte, len(index))
nulls := NewBoolEmpty(uint32(len(index)), nil)
Expand Down

0 comments on commit 3c758ee

Please sign in to comment.