@@ -172,8 +172,21 @@ enum DecryptionKeys {
172
172
ViaRetriever ( Arc < dyn KeyRetriever > ) ,
173
173
}
174
174
175
+ impl PartialEq for DecryptionKeys {
176
+ fn eq ( & self , other : & Self ) -> bool {
177
+ match ( self , other) {
178
+ ( DecryptionKeys :: Explicit ( keys) , DecryptionKeys :: Explicit ( other_keys) ) => {
179
+ keys. footer_key == other_keys. footer_key
180
+ && keys. column_keys == other_keys. column_keys
181
+ }
182
+ ( DecryptionKeys :: ViaRetriever ( _) , DecryptionKeys :: ViaRetriever ( _) ) => true ,
183
+ _ => false ,
184
+ }
185
+ }
186
+ }
187
+
175
188
/// FileDecryptionProperties hold keys and AAD data required to decrypt a Parquet file.
176
- #[ derive( Clone ) ]
189
+ #[ derive( Clone , PartialEq ) ]
177
190
pub struct FileDecryptionProperties {
178
191
keys : DecryptionKeys ,
179
192
pub ( crate ) aad_prefix : Option < Vec < u8 > > ,
@@ -199,25 +212,6 @@ impl std::fmt::Debug for FileDecryptionProperties {
199
212
}
200
213
}
201
214
202
- impl PartialEq for FileDecryptionProperties {
203
- // FileDecryptionProperties needs to implement PartialEq to allow
204
- // ParquetMetaData to implement PartialEq.
205
- // We cannot compare a key retriever, but this isn't derived from the metadata.
206
- fn eq ( & self , other : & Self ) -> bool {
207
- let keys_eq = match self . keys {
208
- DecryptionKeys :: Explicit ( ref keys) => {
209
- if let DecryptionKeys :: Explicit ( ref other_keys) = other. keys {
210
- keys == other_keys
211
- } else {
212
- false
213
- }
214
- }
215
- _ => true ,
216
- } ;
217
- keys_eq && self . aad_prefix == other. aad_prefix
218
- }
219
- }
220
-
221
215
/// Builder for [`FileDecryptionProperties`]
222
216
pub struct DecryptionPropertiesBuilder {
223
217
footer_key : Option < Vec < u8 > > ,
0 commit comments