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

getdozer / dozer / 4121474236

pending completion
4121474236

Pull #760

github

GitHub
Merge 12a6e3822 into ac0e35779
Pull Request #760: chore: improve coverage

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

23982 of 36476 relevant lines covered (65.75%)

38019.66 hits per line

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

94.2
/dozer-sql/src/pipeline/aggregation/tests/aggregation_null.rs
1
use crate::output;
2
use crate::pipeline::aggregation::tests::aggregation_tests_utils::{
3
    delete_exp, delete_field, init_input_schema, init_processor, insert_exp, insert_field,
4
    FIELD_100_INT, FIELD_1_INT, ITALY,
5
};
6

7
use dozer_core::DEFAULT_PORT_HANDLE;
8

9
use dozer_types::types::FieldType::Int;
10
use dozer_types::types::{Field, Operation, Record};
11
use std::collections::HashMap;
12

13
#[test]
1✔
14
fn test_sum_aggregation_null() {
1✔
15
    let schema = init_input_schema(Int, "SUM");
1✔
16
    let (processor, tx) = init_processor(
1✔
17
        "SELECT Country, SUM(Salary) \
1✔
18
        FROM Users \
1✔
19
        WHERE Salary >= 1 GROUP BY Country",
1✔
20
        HashMap::from([(DEFAULT_PORT_HANDLE, schema)]),
1✔
21
    )
1✔
22
    .unwrap();
1✔
23

1✔
24
    // Insert 100 for segment Italy
1✔
25
    /*
1✔
26
        NULL, 100.0
1✔
27
        -------------
1✔
28
        SUM = 100.0
1✔
29
    */
1✔
30
    let inp = Operation::Insert {
1✔
31
        new: Record::new(
1✔
32
            None,
1✔
33
            vec![
1✔
34
                Field::Int(0),
1✔
35
                Field::Null,
1✔
36
                FIELD_100_INT.clone(),
1✔
37
                FIELD_100_INT.clone(),
1✔
38
            ],
1✔
39
            None,
1✔
40
        ),
1✔
41
    };
1✔
42
    let out = output!(processor, inp, tx);
1✔
43
    let exp = vec![Operation::Insert {
1✔
44
        new: Record::new(None, vec![Field::Null, FIELD_100_INT.clone()], None),
1✔
45
    }];
1✔
46
    assert_eq!(out, exp);
1✔
47
}
1✔
48

×
49
#[test]
1✔
50
fn test_sum_aggregation_del_and_insert() {
1✔
51
    let schema = init_input_schema(Int, "COUNT");
1✔
52
    let (processor, tx) = init_processor(
1✔
53
        "SELECT Country, COUNT(Salary) \
1✔
54
        FROM Users \
1✔
55
        WHERE Salary >= 1 GROUP BY Country",
1✔
56
        HashMap::from([(DEFAULT_PORT_HANDLE, schema)]),
1✔
57
    )
1✔
58
    .unwrap();
1✔
59

1✔
60
    // Insert 100 for segment Italy
1✔
61
    /*
1✔
62
        Italy, 100.0
1✔
63
        -------------
1✔
64
        COUNT = 1
1✔
65
    */
1✔
66
    let mut inp = insert_field(ITALY, FIELD_100_INT);
1✔
67
    let mut out = output!(processor, inp, tx);
1✔
68
    let mut exp = vec![insert_exp(ITALY, FIELD_1_INT)];
1✔
69
    assert_eq!(out, exp);
1✔
70

×
71
    // Delete last record
72
    /*
73
        -------------
74
        COUNT = 0
75
    */
76
    inp = delete_field(ITALY, FIELD_100_INT);
1✔
77
    out = output!(processor, inp, tx);
1✔
78
    exp = vec![delete_exp(ITALY, FIELD_1_INT)];
1✔
79
    assert_eq!(out, exp);
1✔
80

×
81
    // Insert 100 for segment Italy
82
    /*
83
        Italy, 100.0
84
        -------------
85
        COUNT = 1
86
    */
87
    let inp = insert_field(ITALY, FIELD_100_INT);
1✔
88
    let out = output!(processor, inp, tx);
1✔
89
    let exp = vec![insert_exp(ITALY, FIELD_1_INT)];
1✔
90
    assert_eq!(out, exp);
1✔
91
}
1✔
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