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

getdozer / dozer / 4102355041

pending completion
4102355041

Pull #811

github

GitHub
Merge 37b55f3df into 7c772e92a
Pull Request #811: chore: integrating sql planner

427 of 427 new or added lines in 15 files covered. (100.0%)

24596 of 37831 relevant lines covered (65.02%)

37254.69 hits per line

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

82.69
/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
    const _AGGREGATOR_ID: u32 = 0x02;
12

13
    pub(crate) fn _get_type() -> u32 {
×
14
        CountAggregator::_AGGREGATOR_ID
×
15
    }
×
16

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

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

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

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