You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/06/30 14:33:46 UTC

[arrow-rs] branch master updated: Revert ParquetError: PartialEq (#4469)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 946890548 Revert ParquetError: PartialEq (#4469)
946890548 is described below

commit 946890548127198f4afeebf637803ecce202e0e5
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Fri Jun 30 15:33:41 2023 +0100

    Revert ParquetError: PartialEq (#4469)
    
    * Revert ParquetError: PartialEq
    
    * Review feedback
---
 parquet/src/errors.rs                 | 20 +++-----------------
 parquet/src/file/serialized_reader.rs |  4 +++-
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/parquet/src/errors.rs b/parquet/src/errors.rs
index f9e3d17c9..0b70266b3 100644
--- a/parquet/src/errors.rs
+++ b/parquet/src/errors.rs
@@ -23,6 +23,9 @@ use std::{cell, io, result, str};
 #[cfg(feature = "arrow")]
 use arrow_schema::ArrowError;
 
+/// Parquet error enumeration
+// Note: we don't implement PartialEq as the semantics for the
+// external variant are not well defined (#4469)
 #[derive(Debug)]
 pub enum ParquetError {
     /// General Parquet error.
@@ -44,23 +47,6 @@ pub enum ParquetError {
     External(Box<dyn Error + Send + Sync>),
 }
 
-impl PartialEq for ParquetError {
-    fn eq(&self, other: &Self) -> bool {
-        match (self, other) {
-            (Self::General(l0), Self::General(r0)) => l0 == r0,
-            (Self::NYI(l0), Self::NYI(r0)) => l0 == r0,
-            (Self::EOF(l0), Self::EOF(r0)) => l0 == r0,
-            #[cfg(feature = "arrow")]
-            (Self::ArrowError(l0), Self::ArrowError(r0)) => l0 == r0,
-            (Self::IndexOutOfBound(l0, l1), Self::IndexOutOfBound(r0, r1)) => {
-                l0 == r0 && l1 == r1
-            }
-            (Self::External(l0), Self::External(r0)) => l0.to_string() == r0.to_string(),
-            _ => false,
-        }
-    }
-}
-
 impl std::fmt::Display for ParquetError {
     fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
         match &self {
diff --git a/parquet/src/file/serialized_reader.rs b/parquet/src/file/serialized_reader.rs
index d0e5420a1..f685f14bd 100644
--- a/parquet/src/file/serialized_reader.rs
+++ b/parquet/src/file/serialized_reader.rs
@@ -810,7 +810,9 @@ mod tests {
         let file_iter = read_from_file.get_row_iter(None).unwrap();
         let cursor_iter = read_from_cursor.get_row_iter(None).unwrap();
 
-        assert!(file_iter.eq(cursor_iter));
+        for (a, b) in file_iter.zip(cursor_iter) {
+            assert_eq!(a.unwrap(), b.unwrap())
+        }
     }
 
     #[test]