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

Port row_ids to arrow1 #8657

Merged
merged 6 commits into from
Jan 13, 2025
Merged

Port row_ids to arrow1 #8657

merged 6 commits into from
Jan 13, 2025

Conversation

emilk
Copy link
Member

@emilk emilk commented Jan 10, 2025

@emilk emilk added 🏹 arrow concerning arrow 🚜 refactor Change the code, not the functionality exclude from changelog PRs with this won't show up in CHANGELOG.md labels Jan 10, 2025
Copy link

github-actions bot commented Jan 10, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
5109fa6 https://rerun.io/viewer/pr/8657 +nightly +main

Note: This comment is updated whenever you push a commit.

@emilk emilk marked this pull request as draft January 10, 2025 22:44
@rerun-io rerun-io deleted a comment from github-actions bot Jan 11, 2025
@rerun-io rerun-io deleted a comment from github-actions bot Jan 11, 2025
@rerun-io rerun-io deleted a comment from github-actions bot Jan 11, 2025
@rerun-io rerun-io deleted a comment from github-actions bot Jan 11, 2025
@emilk emilk force-pushed the emilk/arrow-row-ids branch from 61e99f2 to 910269c Compare January 11, 2025 17:25
@emilk
Copy link
Member Author

emilk commented Jan 11, 2025

@rerun-bot full-check

@emilk emilk marked this pull request as ready for review January 11, 2025 17:30
Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12726236739

@teh-cmc teh-cmc self-requested a review January 13, 2025 09:18
@@ -943,7 +934,11 @@ impl Chunk {
entity_path,
heap_size_bytes: Default::default(),
is_sorted: true,
row_ids: Arrow2StructArray::new_empty(RowId::arrow2_datatype()),
row_ids: arrow::array::StructBuilder::from_fields(
Copy link
Member

Choose a reason for hiding this comment

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

Here and elsewhere, it feels odd to me that we're going through a builder type just to build an empty thing.

Any particular reason we're not calling https://docs.rs/arrow/latest/arrow/array/fn.new_empty_array.html ?

Copy link
Member Author

@emilk emilk Jan 13, 2025

Choose a reason for hiding this comment

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

new_empty_array returns an ArrayRef, meaning we would need .as_any().downcast_ref::<StructArray>().unwrap().clone() here.
StructBuilder returns what we want.

@@ -11,13 +11,18 @@ use crate::{DeserializationError, Loggable};

// ---

// TODO(emilk): This is a bit ugly… but good enough for now?
pub fn tuid_arrow_fields() -> Fields {
Copy link
Member

Choose a reason for hiding this comment

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

Can't you get rid of this if you get rid of using the builder type for an empty array?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but at the cost of some ugly dynamic casting and unwraps that I'd rather avoid

crates/utils/re_byte_size/src/arrow_sizes.rs Outdated Show resolved Hide resolved
#[inline]
fn heap_size_bytes(&self) -> u64 {
self.get_array_memory_size() as u64
}
}

impl<T: ArrowPrimitiveType> SizeBytes for PrimitiveArray<T> {
impl<T: Array> SizeBytes for &T {
Copy link
Member

Choose a reason for hiding this comment

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

Method already takes &self:

Suggested change
impl<T: Array> SizeBytes for &T {
impl<T: Array> SizeBytes for T {

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't:

image

@emilk emilk merged commit d07a374 into main Jan 13, 2025
31 checks passed
@emilk emilk deleted the emilk/arrow-row-ids branch January 13, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏹 arrow concerning arrow exclude from changelog PRs with this won't show up in CHANGELOG.md 🚜 refactor Change the code, not the functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants