Skip to content

Commit

Permalink
chore: replace the legacy numeric constants with new ones (#2486)
Browse files Browse the repository at this point in the history
Signed-off-by: BubbleCal <[email protected]>
  • Loading branch information
BubbleCal authored Jun 19, 2024
1 parent 84a10c8 commit c680b20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions rust/lance-file/src/writer/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,8 +1314,8 @@ mod tests {
fn test_collect_float_stats() {
// NaN values are ignored in statistics
let arrays: Vec<ArrayRef> = vec![
Arc::new(Float32Array::from(vec![4.0f32, 3.0, std::f32::NAN, 2.0])),
Arc::new(Float32Array::from(vec![-10.0f32, 3.0, 5.0, std::f32::NAN])),
Arc::new(Float32Array::from(vec![4.0f32, 3.0, f32::NAN, 2.0])),
Arc::new(Float32Array::from(vec![-10.0f32, 3.0, 5.0, f32::NAN])),
];
let array_refs = arrays.iter().collect::<Vec<_>>();
let stats = collect_statistics(&array_refs);
Expand Down Expand Up @@ -1361,9 +1361,9 @@ mod tests {
// If all values are NaN, min and max are -Inf and Inf respectively,
// NaN values don't count towards null count.
let arrays: Vec<ArrayRef> = vec![Arc::new(Float64Array::from(vec![
std::f64::NAN,
std::f64::NAN,
std::f64::NAN,
f64::NAN,
f64::NAN,
f64::NAN,
]))];
let array_refs = arrays.iter().collect::<Vec<_>>();
let stats = collect_statistics(&array_refs);
Expand Down Expand Up @@ -1677,8 +1677,8 @@ mod tests {
});
builder.append(StatisticsRow {
null_count: 0,
min_value: ScalarValue::Int32(Some(std::i32::MIN)),
max_value: ScalarValue::Int32(Some(std::i32::MAX)),
min_value: ScalarValue::Int32(Some(i32::MIN)),
max_value: ScalarValue::Int32(Some(i32::MAX)),
});

// If we try to finish at this point, it will error since we don't have
Expand All @@ -1697,8 +1697,8 @@ mod tests {
});
builder.append(StatisticsRow {
null_count: 0,
min_value: ScalarValue::Int32(Some(std::i32::MIN)),
max_value: ScalarValue::Int32(Some(std::i32::MAX)),
min_value: ScalarValue::Int32(Some(i32::MIN)),
max_value: ScalarValue::Int32(Some(i32::MAX)),
});

// Collect stats for b
Expand Down Expand Up @@ -1751,11 +1751,11 @@ mod tests {
),
(
Arc::new(ArrowField::new("min_value", DataType::Int32, true)),
Arc::new(Int32Array::from(vec![1, std::i32::MIN])) as ArrayRef,
Arc::new(Int32Array::from(vec![1, i32::MIN])) as ArrayRef,
),
(
Arc::new(ArrowField::new("max_value", DataType::Int32, true)),
Arc::new(Int32Array::from(vec![3, std::i32::MAX])) as ArrayRef,
Arc::new(Int32Array::from(vec![3, i32::MAX])) as ArrayRef,
),
])),
Arc::new(StructArray::from(vec![
Expand Down Expand Up @@ -2005,11 +2005,11 @@ mod tests {
ScalarValue::UInt32(Some(1)),
ScalarValue::UInt64(Some(1)),
ScalarValue::Float32(Some(1.0)),
ScalarValue::Float32(Some(std::f32::INFINITY)),
ScalarValue::Float32(Some(std::f32::NEG_INFINITY)),
ScalarValue::Float32(Some(f32::INFINITY)),
ScalarValue::Float32(Some(f32::NEG_INFINITY)),
ScalarValue::Float64(Some(1.0)),
ScalarValue::Float64(Some(std::f64::INFINITY)),
ScalarValue::Float64(Some(std::f64::NEG_INFINITY)),
ScalarValue::Float64(Some(f64::INFINITY)),
ScalarValue::Float64(Some(f64::NEG_INFINITY)),
ScalarValue::Utf8(Some("foo".to_string())),
ScalarValue::Utf8(Some("a".repeat(BINARY_PREFIX_LENGTH))),
ScalarValue::Binary(Some(vec![0_u8; BINARY_PREFIX_LENGTH])),
Expand Down
2 changes: 1 addition & 1 deletion rust/lance/src/io/exec/pushdown_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ mod test {
4.0,
5.0,
6.0,
std::f32::NAN,
f32::NAN,
3.0,
6.0,
])),
Expand Down

0 comments on commit c680b20

Please sign in to comment.