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

getdozer / dozer / 4339305726

pending completion
4339305726

push

github

GitHub
fix: Ingestion via Arrow (#1141)

57 of 57 new or added lines in 7 files covered. (100.0%)

29731 of 39064 relevant lines covered (76.11%)

54738.05 hits per line

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

71.43
/dozer-sql/src/pipeline/projection/processor.rs
1
use crate::pipeline::expression::execution::{Expression, ExpressionExecutor};
2

3
use dozer_core::channels::ProcessorChannelForwarder;
4
use dozer_core::epoch::Epoch;
5
use dozer_core::errors::ExecutionError;
6
use dozer_core::errors::ExecutionError::InternalError;
7
use dozer_core::node::{PortHandle, Processor};
8
use dozer_core::record_store::RecordReader;
9
use dozer_core::storage::lmdb_storage::SharedTransaction;
10
use dozer_core::DEFAULT_PORT_HANDLE;
11
use dozer_types::types::{Operation, Record, Schema};
12
use std::collections::HashMap;
13

14
#[derive(Debug)]
×
15
pub struct ProjectionProcessor {
16
    expressions: Vec<Expression>,
17
    input_schema: Schema,
18
}
19

20
impl ProjectionProcessor {
21
    pub fn new(input_schema: Schema, expressions: Vec<Expression>) -> Self {
325✔
22
        Self {
325✔
23
            input_schema,
325✔
24
            expressions,
325✔
25
        }
325✔
26
    }
325✔
27

28
    fn delete(&mut self, record: &Record) -> Result<Operation, ExecutionError> {
27,345✔
29
        let mut results = vec![];
27,345✔
30

31
        for expr in &self.expressions {
109,310✔
32
            results.push(
33
                expr.evaluate(record, &self.input_schema)
81,965✔
34
                    .map_err(|e| InternalError(Box::new(e)))?,
81,965✔
35
            );
36
        }
37
        Ok(Operation::Delete {
27,345✔
38
            old: Record::new(None, results, None),
27,345✔
39
        })
27,345✔
40
    }
27,345✔
41

42
    fn insert(&mut self, record: &Record) -> Result<Operation, ExecutionError> {
229,409✔
43
        let mut results = vec![];
229,409✔
44

45
        for expr in self.expressions.clone() {
464,349✔
46
            results.push(
47
                expr.evaluate(record, &self.input_schema)
464,349✔
48
                    .map_err(|e| InternalError(Box::new(e)))?,
464,349✔
49
            );
50
        }
51
        Ok(Operation::Insert {
229,620✔
52
            new: Record::new(None, results, None),
229,620✔
53
        })
229,620✔
54
    }
229,620✔
55

56
    fn update(&self, old: &Record, new: &Record) -> Result<Operation, ExecutionError> {
×
57
        let mut old_results = vec![];
×
58
        let mut new_results = vec![];
×
59

60
        for expr in &self.expressions {
×
61
            old_results.push(
62
                expr.evaluate(old, &self.input_schema)
×
63
                    .map_err(|e| InternalError(Box::new(e)))?,
×
64
            );
65
            new_results.push(
66
                expr.evaluate(new, &self.input_schema)
×
67
                    .map_err(|e| InternalError(Box::new(e)))?,
×
68
            );
69
        }
70

71
        Ok(Operation::Update {
×
72
            old: Record::new(None, old_results, None),
×
73
            new: Record::new(None, new_results, None),
×
74
        })
×
75
    }
×
76
}
77

78
impl Processor for ProjectionProcessor {
79
    fn process(
256,764✔
80
        &mut self,
256,764✔
81
        _from_port: PortHandle,
256,764✔
82
        op: Operation,
256,764✔
83
        fw: &mut dyn ProcessorChannelForwarder,
256,764✔
84
        _tx: &SharedTransaction,
256,764✔
85
        _reader: &HashMap<PortHandle, Box<dyn RecordReader>>,
256,764✔
86
    ) -> Result<(), ExecutionError> {
256,764✔
87
        let _ = match op {
256,764✔
88
            Operation::Delete { ref old } => fw.send(self.delete(old)?, DEFAULT_PORT_HANDLE),
27,175✔
89
            Operation::Insert { ref new } => fw.send(self.insert(new)?, DEFAULT_PORT_HANDLE),
229,589✔
90
            Operation::Update { ref old, ref new } => {
×
91
                fw.send(self.update(old, new)?, DEFAULT_PORT_HANDLE)
×
92
            }
93
        };
94
        Ok(())
256,280✔
95
    }
256,280✔
96

97
    fn commit(&self, _epoch: &Epoch, _tx: &SharedTransaction) -> Result<(), ExecutionError> {
446✔
98
        Ok(())
446✔
99
    }
446✔
100
}
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