Skip to content

Commit 490ca09

Browse files
committed
Use u64 lower parts in decimal comparison fixtures
Signed-off-by: Connor Tsui <[email protected]>
1 parent ac251a6 commit 490ca09

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

  • encodings/decimal-byte-parts/src/decimal_byte_parts/compute

‎encodings/decimal-byte-parts/src/decimal_byte_parts/compute/compare.rs‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,14 @@ mod tests {
612612
)
613613
}
614614

615-
/// Narrow parts cannot hold every constant of their precision: a constant above the parts'
616-
/// range answers by its sign, and a word above a lower part's range sits above every value
617-
/// in that part.
615+
/// A constant beyond the narrow MSP's range answers by its sign. Constants with matching
616+
/// high words still compare their lower words.
618617
#[test]
619-
fn narrow_parts_match_decimal() -> VortexResult<()> {
618+
fn narrow_msp_matches_decimal() -> VortexResult<()> {
620619
let dtype = DecimalDType::new(38, 2);
621620
let validity = Validity::from_iter([true, false, true, true]);
622621
let msp = PrimitiveArray::new(buffer![1i16, 0, -1, 3], validity.clone()).into_array();
623-
let lower = buffer![5u16, 7, 9, u16::MAX].into_array();
622+
let lower = buffer![5u64, 7, 9, u64::from(u16::MAX)].into_array();
624623
let array = DecimalByteParts::try_new_with_lower_parts(msp, vec![lower], dtype)?;
625624

626625
let values: Vec<i128> = vec![
@@ -650,15 +649,14 @@ mod tests {
650649
)
651650
}
652651

653-
/// Middle lower parts can also be narrow. A word above a middle part's range decides the
654-
/// answer before the less significant parts.
652+
/// A differing middle word decides the answer before the less significant parts.
655653
#[test]
656-
fn narrow_middle_parts_match_decimal() -> VortexResult<()> {
654+
fn middle_parts_match_decimal() -> VortexResult<()> {
657655
let dtype = DecimalDType::new(76, 2);
658656
let validity = Validity::from_iter([true, false, true, true]);
659657
let msp = PrimitiveArray::new(buffer![1i8, 0, -1, 3], validity.clone()).into_array();
660-
let upper = buffer![5u8, 7, u8::MAX, 0].into_array();
661-
let middle = buffer![9u16, u16::MAX, 0, 3].into_array();
658+
let upper = buffer![5u64, 7, u64::from(u8::MAX), 0].into_array();
659+
let middle = buffer![9u64, u64::from(u16::MAX), 0, 3].into_array();
662660
let lower = buffer![2u64, u64::MAX, 4, 0].into_array();
663661
let array =
664662
DecimalByteParts::try_new_with_lower_parts(msp, vec![upper, middle, lower], dtype)?;

0 commit comments

Comments
 (0)