-
Notifications
You must be signed in to change notification settings - Fork 924
feat: impl PartialEq + Eq
for GetOptions
& PutPayload
#7152
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ use bytes::Bytes; | |
use std::sync::Arc; | ||
|
||
/// A cheaply cloneable, ordered collection of [`Bytes`] | ||
#[derive(Debug, Clone)] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if people might expect this to be agnostic to chunking? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. I think NOT equalizing chunking might be the more correct Eq implementation, because if you want to test optimizations / implementation details, this is important. I think we should document it though. |
||
pub struct PutPayload(Arc<[Bytes]>); | ||
|
||
impl Default for PutPayload { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work if we add a dyn Any context/extensions field as being discussed in #7135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we require extensions to implement not only
Any
but alsoEq
andPartialEq
w/ their own type? That would require some additional bookkeeping code withingAnyMap
to store the vtable entries though, or don't useAny
at all buttrait Extension: Eq + std::fmt::Debug
or something like that. The more I think about it, the more convinced I am that a proper new trait would be better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eq
andPartialEq
aren't dyn-compatible because they takeSelf
as a type parameter: https://doc.rust-lang.org/error_codes/E0038.html#trait-uses-self-as-a-type-parameter-in-the-supertrait-listingWe could work around that with custom
PartialEq
andEq
implementations that ignore the extensions field discussed in https://github.com/apache/arrow-rs/issues/7155 (opened in favor of #7135). Given that the extensions are meant to be used by customObjectStore
implementations/wrappers and ignored by the builtin backends this shouldn't be a problem, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's not dyn-safe, but you still can implement this via a trait and the right signature, see #7160 (comment)