Skip to content

Conversation

@brancz
Copy link
Contributor

@brancz brancz commented Dec 16, 2025

Which issue does this PR close?

Rationale for this change

See the issue.

What changes are included in this PR?

Add tests and support for ListView/LargeListView support for arrow-ipc.

Are these changes tested?

Yes, various test cases added.

Are there any user-facing changes?

No breaking changes, strictly new support for types.

@alamb @vegarsti

@brancz brancz mentioned this pull request Dec 16, 2025
@github-actions github-actions bot added the arrow Changes to the arrow crate label Dec 16, 2025
Copy link
Contributor

@vegarsti vegarsti left a comment

Choose a reason for hiding this comment

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

Great! I did a cursory review.

.add_buffer(buffers[2].clone()) // sizes
.add_child_data(child_data)
.null_bit_buffer(null_buffer),
_ => unreachable!("Cannot create listview array from {:?}", data_type),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this function can return an error, should this be an error instead of unreachable?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially return "internal error" or something -- however, since the code can only be called with a ListView / LargeListView it is probably fine.

Looking more at this code, it seems like this is more of an assert -- perhaps the intent would be clearer if it explicitly did something like

assert!(matches!(data_type, ListView(_)|LargeListView(_));
let mut builder = ArrayData::builder(data_type.clone())
  .len(length)
  .add_buffer(buffers[1].clone()) // offsets
  .add_buffer(buffers[2].clone()) // sizes
..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I overindexed on making the function look like the other ones. I agree, I like the assert better as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, yeah, that's better!

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.

Thank you @brancz -- the only thing I think this PR needs prior to merge is a test with nulls. Otherwise it looks great.

Thanks @vegarsti for the review. I think your suggestion is definitely worth considering too

.add_buffer(buffers[2].clone()) // sizes
.add_child_data(child_data)
.null_bit_buffer(null_buffer),
_ => unreachable!("Cannot create listview array from {:?}", data_type),
Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially return "internal error" or something -- however, since the code can only be called with a ListView / LargeListView it is probably fine.

Looking more at this code, it seems like this is more of an assert -- perhaps the intent would be clearer if it explicitly did something like

assert!(matches!(data_type, ListView(_)|LargeListView(_));
let mut builder = ArrayData::builder(data_type.clone())
  .len(length)
  .add_buffer(buffers[1].clone()) // offsets
  .add_buffer(buffers[2].clone()) // sizes
..

}
}

fn generate_nested_list_view_data<O: OffsetSizeTrait>() -> GenericListViewArray<O> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

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.

Thanks again @brancz and @vegarsti

@alamb alamb merged commit 3b097a5 into apache:main Dec 18, 2025
26 checks passed
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.

IPC support for ListView

3 participants