Skip to content

csup.Writer: Use vbuild.Builder#6982

Open
mattnibs wants to merge 1 commit into
mainfrom
csup-vector-builder
Open

csup.Writer: Use vbuild.Builder#6982
mattnibs wants to merge 1 commit into
mainfrom
csup-vector-builder

Conversation

@mattnibs
Copy link
Copy Markdown
Collaborator

@mattnibs mattnibs commented May 21, 2026

This commit improves the csup.Writer by using vbuild.Builder to build vectors that eventually get encoded as CSUP. vbuild.Builder has improvements over the what existed in csup.Writer including the ability to handle vectors with Views, Consts or Dicts.

This PR also removes Scode columns in CSUP, changing things so bool, ip, net, and enum vectors are now natively encoded.

@mattnibs mattnibs requested a review from a team May 21, 2026 18:20
This commit improves the csup.Writer but using vbuild.Builder to build
vectors that eventually get encoded as CSUP. vbuild.Builder has
improvements over the what existed is csup.Writer including the ability
to handle vectors with Views, Consts or Dicts.

This pr also removes Scode columns in CSUP, changing things so bool, ip,
net, enum vectors are now natively encoded.
@mattnibs mattnibs force-pushed the csup-vector-builder branch from e907b0a to 721a43c Compare May 21, 2026 18:22
Comment thread csup/bytes.go
Comment on lines +35 to +40
s := table.Bytes(i)
if bytes.Compare(s, b.min) < 0 {
b.min = s
}
if bytes.Compare(s, b.max) > 0 {
b.max = s
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
s := table.Bytes(i)
if bytes.Compare(s, b.min) < 0 {
b.min = s
}
if bytes.Compare(s, b.max) > 0 {
b.max = s
v := table.Bytes(i)
if bytes.Compare(v, b.min) < 0 {
b.min = v
}
if bytes.Compare(s, b.max) > 0 {
b.max = v

Comment thread csup/const.go
len uint32
}

func (c *ConstEncoder) Encode(group *errgroup.Group) {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (c *ConstEncoder) Encode(group *errgroup.Group) {}
func (*ConstEncoder) Encode(*errgroup.Group) {}

Comment thread csup/const.go
return off, cctx.enter(&Const{c.val, c.len})
}

func (c *ConstEncoder) Emit(w io.Writer) error { return nil }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (c *ConstEncoder) Emit(w io.Writer) error { return nil }
func (*ConstEncoder) Emit(io.Writer) error { return nil }

Comment thread csup/encoder.go
switch vec := vec.(type) {
case *vector.Named:
return NewNamedEncoder(cctx, vec)
case *vector.Error:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Usual order is record, array, set, map, union, enum, error, and then fusion.

Comment thread csup/field.go
"golang.org/x/sync/errgroup"
)

// XXX in a forthcoming PR, we will change this to OptionEncoder
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this while you're here?

Suggested change

Comment thread csup/null.go
Comment on lines +36 to +37
func (n *NoneEncoder) Encode(group *errgroup.Group) {}
func (n *NoneEncoder) Emit(io.Writer) error { return nil }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (n *NoneEncoder) Encode(group *errgroup.Group) {}
func (n *NoneEncoder) Emit(io.Writer) error { return nil }
func (*NoneEncoder) Encode(group *errgroup.Group) {}
func (*NoneEncoder) Emit(io.Writer) error { return nil }

Comment thread csup/null.go
Comment on lines +24 to +26
type NoneEncoder struct {
len uint32
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in none.go?

Comment thread csup/union.go
type UnionEncoder struct {
typ *super.TypeUnion
values []Encoder
tags *Uint32Encoder
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tags *Uint32Encoder
rleOrTags *Uint32Encoder

Comment thread csup/union.go
}
if rle[0] == 0 {
rle = rle[1:]
var tags []uint32
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var tags []uint32
var rleOrTags []uint32

Comment thread runtime/vcache/bytes.go
Comment on lines +67 to 68
table := vector.NewBytesTable(offs, b)
return table
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
table := vector.NewBytesTable(offs, b)
return table
return vector.NewBytesTable(offs, b)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants