Skip to content

vector/vbuild: fix DynamicBuilder bug on same-type dynamic - #7477

Merged
nwt merged 1 commit into
mainfrom
fix-NewDynamicBuilder-bug
Oct 14, 2026
Merged

nwt merged 1 commit into
mainfrom
fix-NewDynamicBuilder-bug

Conversation

@nwt

@nwt nwt commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

A vector.Dynamic containing multiple vectors with the same type can reorder their values because the vectors are written to a single vbuild.Builder. Fix this by calling MergeSameTypesInDynamic.

The test added in bsup/ztests/dynamic-same-type.yaml is unfortunately oblique because ztests don't offer a way to create a vector with a prescribed structure.

@nwt
nwt requested a review from a team October 14, 2026 18:16
A vector.Dynamic containing multiple vectors with the same type can
reorder their values because the vectors are written to a single
vbuild.Builder.  Fix this by calling MergeSameTypesInDynamic.

The test added in bsup/ztests/dynamic-same-type.yaml is unfortunately
oblique because ztests don't offer a way to create a vector with a
prescribed structure.
@nwt
nwt force-pushed the fix-NewDynamicBuilder-bug branch from 2e8797e to c17ecec Compare October 14, 2026 18:32

@mccanne mccanne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't this O(n^2)?

@nwt

nwt commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Isn't this O(n^2)

I think it's O(n * number of types in dynamic with same-type vectors). Looks like we can get that down to O(n) if we need to though.

@nwt
nwt merged commit b958522 into main Oct 14, 2026
2 checks passed
@nwt
nwt deleted the fix-NewDynamicBuilder-bug branch October 14, 2026 19:05
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