Skip to content

Commit

Permalink
use get_scalar_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-isaacs committed Jan 31, 2025
1 parent 64b5897 commit 68fb90d
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions vortex-array/src/stats/stats_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,8 @@ impl StatsSet {

fn merge_min(&mut self, other: &Self, dtype: &DType) {
match (
self.get_scalar(Stat::Min, dtype.clone())
.map(|s| s.bound::<Min>()),
other
.get_scalar(Stat::Min, dtype.clone())
.map(|s| s.bound::<Min>()),
self.get_scalar_bound::<Min>(dtype.clone()),
other.get_scalar_bound::<Min>(dtype.clone()),
) {
(Some(m1), Some(m2)) => {
let meet = m1.union(&m2).vortex_expect("can compare scalar");
Expand All @@ -377,11 +374,8 @@ impl StatsSet {

fn merge_max(&mut self, other: &Self, dtype: &DType) {
match (
self.get_scalar(Stat::Max, dtype.clone())
.map(|s| s.bound::<Max>()),
other
.get_scalar(Stat::Max, dtype.clone())
.map(|s| s.bound::<Max>()),
self.get_scalar_bound::<Max>(dtype.clone()),
other.get_scalar_bound::<Max>(dtype.clone()),
) {
(Some(m1), Some(m2)) => {
let meet = m1.union(&m2).vortex_expect("can compare scalar");
Expand Down Expand Up @@ -434,13 +428,10 @@ impl StatsSet {
// We assume that it was the dropped case since the doesn't exist might imply sorted,
// but this in-precision is correct.
if let (Some(self_max), Some(other_min)) = (
self.get_scalar(Stat::Max, dtype.clone()),
other.get_scalar(Stat::Min, dtype.clone()),
self.get_scalar_bound::<Max>(dtype.clone()),
other.get_scalar_bound::<Min>(dtype.clone()),
) {
return if cmp(
&self_max.bound::<Max>().max_value(),
&other_min.bound::<Min>().min_value(),
) {
return if cmp(&self_max.max_value(), &other_min.min_value()) {
// keep value
} else {
self.set(stat, Precision::inexact(false));
Expand Down

0 comments on commit 68fb90d

Please sign in to comment.