Skip to content

Cleanup length and bit_length kernels#4718

Merged
tustvold merged 5 commits intoapache:masterfrom
tustvold:cleanup-bit-length-kernel
Aug 25, 2023
Merged

Cleanup length and bit_length kernels#4718
tustvold merged 5 commits intoapache:masterfrom
tustvold:cleanup-bit-length-kernel

Conversation

@tustvold
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Comment thread arrow-string/src/length.rs Outdated
))),
other => Err(ArrowError::ComputeError(format!(
"bit_length not supported for {other:?}"
"length not supported for {other:?}"
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread arrow-string/src/length.rs Outdated
))),
other => Err(ArrowError::ComputeError(format!(
"bit_length not supported for {other:?}"
"length not supported for {other:?}"
Copy link
Copy Markdown
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
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