etseidl commented on code in PR #7687: URL: https://github.com/apache/arrow-rs/pull/7687#discussion_r2167430766
########## parquet/src/data_type.rs: ########## @@ -132,6 +132,23 @@ impl Int96 { } } +impl PartialOrd for Int96 { + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + Some(self.cmp(other)) + } +} + +impl Ord for Int96 { + fn cmp(&self, other: &Self) -> Ordering { + let (self_days, self_nanos) = self.data_as_days_and_nanos(); + let (other_days, other_nanos) = other.data_as_days_and_nanos(); + + match self_days.cmp(&other_days) { Review Comment: Micro-optimization: we could add `get_days` and `get_nanos` to `Int96`, and then change this to ```rust match self.get_days().cmp(&other.get_days()) { Ordering::Equal => self.get_nanos().cmp(&other.get_nanos()), ord => ord, } ``` That would save a few instructions when the days are not equal. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org