atefsawaed commented on code in PR #1621:
URL: https://github.com/apache/arrow-rs/pull/1621#discussion_r861191944
##########
parquet/src/column/writer.rs:
##########
@@ -1049,6 +1084,54 @@ fn has_dictionary_support(kind: Type, props:
&WriterProperties) -> bool {
}
}
+/// Signed comparison of bytes arrays
+fn compare_greater_byte_array_decimals(a: &[u8], b: &[u8]) -> bool {
+ let a_length = a.len();
+ let b_length = b.len();
+
+ if a_length == 0 || b_length == 0 {
+ return a_length > 0 && b_length == 0;
+ }
+
+ let first_a: u8 = a[0];
+ let first_b: u8 = b[0];
+
+ // We can short circuit for different signed numbers or
+ // for equal length bytes arrays that have different first bytes.
+ // The equality requirement is necessary for sign extension cases.
+ // 0xFF10 should be equal to 0x10 (due to big endian sign extension).
+ if (0x80 & first_a) != (0x80 & first_b)
+ || (a_length == b_length && first_a != first_b)
Review Comment:
In case of equal length bytes arrays with different first bytes, it is
enough to compare the first bytes in order to determine the ordering.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]