Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

feat: basic BoolBuffer / BoolBufferMut#2456

Open
a10y wants to merge4 commits intodevelop
base:develop
Choose a base branch
Loading
fromaduffy/bool-buffer

Conversation

a10y
Copy link
Contributor

@a10ya10y commentedFeb 21, 2025
edited
Loading

It's very annoying to do random in-place setting of bits in Arrow BooleanBufferBuilder. It's very append focused. For something like SparseArray in particular, you want to create a BoolArray against uninitialized memory and only set the bits corresponding to positions of non-null values.

AdamGS reacted with hooray emoji
@gatesn
Copy link
Contributor

Can we call this BitBuffer?

a10y and lwwmanning reacted with thumbs up emoji

@a10ya10y marked this pull request as ready for reviewFebruary 21, 2025 17:10
@a10ya10y marked this pull request as draftFebruary 21, 2025 17:12
Copy link
Contributor

@gatesngatesn left a comment

Choose a reason for hiding this comment

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

Think we'll also want iterators and vectorized constructors (i.e. BooleanBuffer::collect_bool)

Self {
buffer: self.buffer.clone(),
len,
offset: self.offset + start,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to guarantee that we only hold a bit_offset? i.e.offset < 8?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hmm, does that help much?

@a10ya10yforce-pushed theaduffy/bool-buffer branch 2 times, most recently from25fc4bd to67729e2CompareFebruary 24, 2025 22:51
@a10ya10y marked this pull request as ready for reviewFebruary 24, 2025 22:52
@a10y
Copy link
ContributorAuthor

a10y commentedFeb 25, 2025
edited
Loading

Sadlynew_uninit leads to UB when you try and do inplace updates on it. I can't think of a great way to work around that without doing something like having a second bitset, which sort of defeats the point of avoiding the initialization cost anyway, so for now I'm just removing it.

@gatesn
Copy link
Contributor

Where are we at with this? Need someone to takeover while you poke at FFI bindings?

@a10y
Copy link
ContributorAuthor

a10y commentedMar 2, 2025

Maybe? I'm no longer sure there's a strong path forward that gives us something better than Arrow's BooleanBufferBuilder.

The big issue is that mapping a bitset on top of uninit memory causes UB when you try and set bits in-place. While it generally seems harmless it is technically a violation of Rust's memory model so not guaranteed to work across platforms.

@gatesn
Copy link
Contributor

Why does the memory have to be uninitialized? Even the ability to into_mut and update bits is valuable from an API perspective.

@robert3005
Copy link
Member

I will take over this pr

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

@gatesngatesngatesn left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@a10y@gatesn@robert3005

[8]ページ先頭

©2009-2025 Movatter.jp