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

Array Length #445

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Array Length #445

merged 2 commits into from
Jul 10, 2024

Conversation

gatesn
Copy link
Contributor

@gatesn gatesn commented Jul 10, 2024

No description provided.

@gatesn gatesn enabled auto-merge (squash) July 10, 2024 19:54
}

#[inline]
pub fn chunk(&self, idx: usize) -> Option<Array> {
let chunk_start = usize::try_from(&scalar_at(&self.chunk_ends(), idx).unwrap()).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

There's a method on primitive array to get the scalar value out. Since we construct the ends array ourselves it should be safe to use it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not if it's been compressed

Copy link
Member

Choose a reason for hiding this comment

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

hmm, ok, forgot this can be read

@@ -65,11 +76,12 @@ impl ArrayData {
self.buffer
}

pub fn child(&self, index: usize, dtype: &DType) -> Option<&Array> {
pub fn child(&self, index: usize, dtype: &DType, len: usize) -> Option<&Array> {
Copy link
Contributor

Choose a reason for hiding this comment

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

both this and the dtype check feel potentially unnecessary, or at least maybe could be debug assertions?

@gatesn gatesn merged commit e8b81c7 into develop Jul 10, 2024
2 checks passed
@gatesn gatesn deleted the ngates/array-length branch July 10, 2024 20:43
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.

3 participants