Skip to content

repr: ByteString to represent u8 vectors#35017

Draft
antiguru wants to merge 2 commits intoMaterializeInc:mainfrom
antiguru:explicit_byte_string
Draft

repr: ByteString to represent u8 vectors#35017
antiguru wants to merge 2 commits intoMaterializeInc:mainfrom
antiguru:explicit_byte_string

Conversation

@antiguru
Copy link
Member

@antiguru antiguru commented Feb 15, 2026

Introduce explicit ByteString and ByteStr types to represent byte vectors and slices. This creates more clarity around types (it's not multiple byte arguments) and allows us to have implementations for vectors and slices that would otherwise conflict. No behavior changes expected.

@antiguru antiguru requested a review from a team as a code owner February 15, 2026 20:36
@github-actions
Copy link

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

antiguru and others added 2 commits February 16, 2026 13:47
Introduce explicit `ByteString` type to represent byte vectors. This
creates more clarity around types (it's not multiple byte arguments) and
allows us to have implementations for vectors that would otherwise
conflict. No behavior changes expected.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
@antiguru antiguru force-pushed the explicit_byte_string branch from 2ffc90b to bcc6eeb Compare February 16, 2026 12:47
@antiguru antiguru requested review from petrosagg and teskje February 16, 2026 14:42
@antiguru antiguru marked this pull request as draft February 16, 2026 15:41
Copy link
Contributor

@teskje teskje left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me. I don't quite follow the motivation. The comments say that these types let us avoid conflicting impls, but the PR doesn't introduce any impls on the new types, except for the ones that already existed on Vec<u8>. Can you give an example of a thing we can do now that we couldn't do before?

}

impl AsColumnType for Vec<u8> {
/// A byte string reference, equivalent to `&[u8]`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not quite true, right? ByteStr is not a reference but is expected to be used behind a reference. It's equivalent to [u8], not &[u8].

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