• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

flowlight0 / simpledb-rs / #70

17 Jun 2025 02:04PM UTC coverage: 80.109% (-0.2%) from 80.327%
#70

push

web-flow
Add null support in query processor (#78)

8 of 20 new or added lines in 7 files covered. (40.0%)

2654 of 3313 relevant lines covered (80.11%)

1.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/materialization/max_function.rs
1
use crate::{
2
    errors::TransactionError,
3
    record::field::Value,
4
    scan::{Scan, ScanControl},
5
};
6

7
use super::aggregation_function::AggregationFnControl;
8

9
#[derive(Clone)]
10
pub struct MaxFn {
11
    max_value: Option<Value>,
12
    field_name: String,
13
}
14

15
impl MaxFn {
16
    pub fn new(field_name: &str) -> Self {
1✔
17
        MaxFn {
18
            max_value: None,
19
            field_name: field_name.to_string(),
1✔
20
        }
21
    }
22
}
23

24
impl AggregationFnControl for MaxFn {
25
    fn process_first(&mut self, scan: &mut Scan) -> Result<(), TransactionError> {
1✔
26
        let value = scan.get_value(&self.field_name)?;
2✔
27
        if value == Value::Null {
2✔
NEW
28
            self.max_value = None;
×
29
        } else {
30
            self.max_value = Some(value);
1✔
31
        }
32
        Ok(())
1✔
33
    }
34

35
    fn process_next(&mut self, scan: &mut Scan) -> Result<(), TransactionError> {
1✔
36
        let new_value = scan.get_value(&self.field_name)?;
1✔
37
        if new_value == Value::Null {
2✔
NEW
38
            return Ok(());
×
39
        }
40
        if let Some(max) = &mut self.max_value {
2✔
41
            if new_value > *max {
3✔
42
                *max = new_value;
1✔
43
            }
44
        } else {
NEW
45
            self.max_value = Some(new_value);
×
46
        }
47
        Ok(())
1✔
48
    }
49

50
    fn get_field_name(&self) -> &str {
1✔
51
        &self.field_name
1✔
52
    }
53

54
    fn get_value(&self) -> Option<Value> {
1✔
55
        self.max_value.clone()
1✔
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc