csup.Writer: Use vbuild.Builder#6982
Open
mattnibs wants to merge 1 commit into
Open
Conversation
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.
e907b0a to
721a43c
Compare
nwt
approved these changes
May 22, 2026
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 |
Member
There was a problem hiding this comment.
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 |
| len uint32 | ||
| } | ||
|
|
||
| func (c *ConstEncoder) Encode(group *errgroup.Group) {} |
Member
There was a problem hiding this comment.
Suggested change
| func (c *ConstEncoder) Encode(group *errgroup.Group) {} | |
| func (*ConstEncoder) Encode(*errgroup.Group) {} |
| return off, cctx.enter(&Const{c.val, c.len}) | ||
| } | ||
|
|
||
| func (c *ConstEncoder) Emit(w io.Writer) error { return nil } |
Member
There was a problem hiding this comment.
Suggested change
| func (c *ConstEncoder) Emit(w io.Writer) error { return nil } | |
| func (*ConstEncoder) Emit(io.Writer) error { return nil } |
| switch vec := vec.(type) { | ||
| case *vector.Named: | ||
| return NewNamedEncoder(cctx, vec) | ||
| case *vector.Error: |
Member
There was a problem hiding this comment.
Nit: Usual order is record, array, set, map, union, enum, error, and then fusion.
| "golang.org/x/sync/errgroup" | ||
| ) | ||
|
|
||
| // XXX in a forthcoming PR, we will change this to OptionEncoder |
Member
There was a problem hiding this comment.
Delete this while you're here?
Suggested change
Comment on lines
+36
to
+37
| func (n *NoneEncoder) Encode(group *errgroup.Group) {} | ||
| func (n *NoneEncoder) Emit(io.Writer) error { return nil } |
Member
There was a problem hiding this comment.
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 on lines
+24
to
+26
| type NoneEncoder struct { | ||
| len uint32 | ||
| } |
| type UnionEncoder struct { | ||
| typ *super.TypeUnion | ||
| values []Encoder | ||
| tags *Uint32Encoder |
Member
There was a problem hiding this comment.
Suggested change
| tags *Uint32Encoder | |
| rleOrTags *Uint32Encoder |
| } | ||
| if rle[0] == 0 { | ||
| rle = rle[1:] | ||
| var tags []uint32 |
Member
There was a problem hiding this comment.
Suggested change
| var tags []uint32 | |
| var rleOrTags []uint32 |
Comment on lines
+67
to
68
| table := vector.NewBytesTable(offs, b) | ||
| return table |
Member
There was a problem hiding this comment.
Suggested change
| table := vector.NewBytesTable(offs, b) | |
| return table | |
| return vector.NewBytesTable(offs, b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.