Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup length and bit_length kernels #4718

Merged
merged 5 commits into from
Aug 25, 2023

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 21, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

A few minor nits, but otherwise this looks like a really nice cleanup @tustvold

Less unsafe and perhaps faster 👍

nulls: Option<&NullBuffer>,
) -> ArrayRef {
let v: Vec<_> = offsets
.windows(2)
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 very clever 👍

let list = array.as_binary::<i64>();
Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls()))
}
DataType::FixedSizeBinary(len) => Ok(Arc::new(Int32Array::new(
Copy link
Contributor

Choose a reason for hiding this comment

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

the support for FixedSizeBinary seems to be new here but there is no test update -- maybe we can add a test for it?

other => Err(ArrowError::ComputeError(format!(
"bit_length not supported for {other:?}"
"length not supported for {other:?}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the prior message was correct as this is the bit_length implementation 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this was a copypasta

other => Err(ArrowError::ComputeError(format!(
"bit_length not supported for {other:?}"
"length not supported for {other:?}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"length not supported for {other:?}"
"bit_length not supported for {other:?}"

@tustvold tustvold mentioned this pull request Aug 24, 2023
@tustvold tustvold merged commit 2fe9ef1 into apache:master Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants