MCPcopy Create free account
hub / github.com/apache/paimon-rust / java_bytes_cmp

Function java_bytes_cmp

crates/paimon/src/spec/predicate.rs:187–195  ·  view source on GitHub ↗

Match Java `CompareUtils.compare(byte[], byte[])`, which compares signed bytes lexicographically.

(a: &[u8], b: &[u8])

Source from the content-addressed store, hash-verified

185/// Match Java `CompareUtils.compare(byte[], byte[])`, which compares signed
186/// bytes lexicographically.
187fn java_bytes_cmp(a: &[u8], b: &[u8]) -> Ordering {
188 for (&lhs, &rhs) in a.iter().zip(b.iter()) {
189 let cmp = (lhs as i8).cmp(&(rhs as i8));
190 if cmp != Ordering::Equal {
191 return cmp;
192 }
193 }
194 a.len().cmp(&b.len())
195}
196
197/// 10^exp as i128. Returns i128::MAX for exponents that would overflow.
198fn pow10_i128(exp: u32) -> i128 {

Callers 1

datum_cmpFunction · 0.85

Calls 3

cmpMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected