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

getdozer / dozer / 4060889261

pending completion
4060889261

Pull #760

github

GitHub
Merge 2e12e4b69 into de98caa91
Pull Request #760: chore: improve coverage

245 of 245 new or added lines in 6 files covered. (100.0%)

25295 of 39298 relevant lines covered (64.37%)

37157.92 hits per line

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

83.64
/dozer-sql/src/pipeline/aggregation/count.rs
1
use crate::pipeline::aggregation::aggregator::AggregationResult;
2
use crate::pipeline::errors::PipelineError;
3
use crate::{deserialize, deserialize_i64};
4
use dozer_core::storage::prefix_transaction::PrefixTransaction;
5
use dozer_types::types::Field::Int;
6
use dozer_types::types::{Field, FieldType};
7

8
pub struct CountAggregator {}
9

10
impl CountAggregator {
11
    pub(crate) fn get_return_type() -> FieldType {
82✔
12
        FieldType::Int
82✔
13
    }
82✔
14

×
15
    pub(crate) fn insert(
16,660✔
16
        cur_state: Option<&[u8]>,
16,660✔
17
        _new: &Field,
16,660✔
18
        _return_type: FieldType,
16,660✔
19
        _txn: &mut PrefixTransaction,
16,660✔
20
    ) -> Result<AggregationResult, PipelineError> {
16,660✔
21
        let prev = deserialize_i64!(cur_state);
16,660✔
22
        let buf = (prev + 1).to_be_bytes();
16,660✔
23
        Ok(AggregationResult::new(
16,660✔
24
            Self::get_value(&buf),
16,660✔
25
            Some(Vec::from(buf)),
16,660✔
26
        ))
16,660✔
27
    }
16,660✔
28

×
29
    pub(crate) fn update(
8✔
30
        cur_state: Option<&[u8]>,
8✔
31
        _old: &Field,
8✔
32
        _new: &Field,
8✔
33
        _return_type: FieldType,
8✔
34
        _txn: &mut PrefixTransaction,
8✔
35
    ) -> Result<AggregationResult, PipelineError> {
8✔
36
        let prev = deserialize_i64!(cur_state);
8✔
37
        let buf = (prev).to_be_bytes();
8✔
38
        Ok(AggregationResult::new(
8✔
39
            Self::get_value(&buf),
8✔
40
            Some(Vec::from(buf)),
8✔
41
        ))
8✔
42
    }
8✔
43

×
44
    pub(crate) fn delete(
41✔
45
        cur_state: Option<&[u8]>,
41✔
46
        _old: &Field,
41✔
47
        _return_type: FieldType,
41✔
48
        _txn: &mut PrefixTransaction,
41✔
49
    ) -> Result<AggregationResult, PipelineError> {
41✔
50
        let prev = deserialize_i64!(cur_state);
41✔
51
        let buf = (prev - 1).to_be_bytes();
41✔
52
        Ok(AggregationResult::new(
41✔
53
            Self::get_value(&buf),
41✔
54
            Some(Vec::from(buf)),
41✔
55
        ))
41✔
56
    }
41✔
57

×
58
    pub(crate) fn get_value(f: &[u8]) -> Field {
16,709✔
59
        Int(i64::from_be_bytes(deserialize!(f)))
16,709✔
60
    }
16,709✔
61
}
×
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

© 2025 Coveralls, Inc