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 equality for &dyn Array (#3880) #3899

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Part of #3880

Rationale for this change

This is part of being able to move away from Array::data

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 Mar 21, 2023
@@ -425,13 +425,13 @@ pub trait ArrayAccessor: Array {
unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}

impl PartialEq for dyn Array {
impl PartialEq for dyn Array + '_ {
Copy link
Contributor Author

@tustvold tustvold Mar 21, 2023

Choose a reason for hiding this comment

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

This is the major "fix", previously this had an implicit 'static lifetime for dyn Array, which would then result in incredibly opaque compilation errors if you actually tried to use this

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't even understand what this means -- "any lifeime"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's documented here - https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes

I was aware it applied to things like Box<dyn Foo> but hadn't occurred to me that dyn Foo on its own also has an implicit 'static

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.

I like the methodological, small sequence of PRs leading up to removing ArrayData 👍

@@ -425,13 +425,13 @@ pub trait ArrayAccessor: Array {
unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}

impl PartialEq for dyn Array {
impl PartialEq for dyn Array + '_ {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't even understand what this means -- "any lifeime"?

let b = NullArray::new(12);
let b = b.data();
test_equal(a, b, true);
test_equal(&a, &b, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

That is certainly nicer

@tustvold tustvold merged commit b1cfe84 into apache:master Mar 22, 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.

2 participants