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

getdozer / dozer / 4195006582

pending completion
4195006582

Pull #918

github

GitHub
Merge 14ceac9a6 into dc166625f
Pull Request #918: ObjectStore - Reduce code duplication & more clone prevention

177 of 177 new or added lines in 5 files covered. (100.0%)

24368 of 37519 relevant lines covered (64.95%)

43913.78 hits per line

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

0.0
/dozer-ingestion/src/connectors/object_store/helper.rs
1
use crate::errors::{ObjectStoreConnectorError, ObjectStoreObjectError};
2
use datafusion::datasource::file_format::csv::CsvFormat;
3
use datafusion::datasource::file_format::parquet::ParquetFormat;
4
use datafusion::datasource::listing::ListingOptions;
5
use dozer_types::ingestion_types::Table;
6
use std::sync::Arc;
7

×
8
pub fn map_listing_options(data_fusion_table: &Table) -> ListingOptions {
×
9
    match data_fusion_table.file_type.as_str() {
×
10
        "parquet" => {
×
11
            let format = ParquetFormat::new();
×
12
            ListingOptions::new(Arc::new(format))
×
13
                .with_file_extension(data_fusion_table.extension.clone())
×
14
        }
×
15
        "csv" => {
×
16
            let format = CsvFormat::default();
×
17
            ListingOptions::new(Arc::new(format))
×
18
                .with_file_extension(data_fusion_table.extension.clone())
×
19
        }
20
        _ => {
×
21
            let format = ParquetFormat::new();
×
22
            ListingOptions::new(Arc::new(format))
×
23
                .with_file_extension(data_fusion_table.extension.clone())
×
24
        }
25
    }
×
26
}
×
27

28
pub fn get_details<T>(details: &Option<T>) -> Result<&T, ObjectStoreConnectorError> {
×
29
    details
×
30
        .as_ref()
×
31
        .ok_or(ObjectStoreConnectorError::DataFusionStorageObjectError(
×
32
            ObjectStoreObjectError::MissingStorageDetails,
×
33
        ))
×
34
}
×
35

36
pub fn get_table<'a>(
×
37
    tables: &'a [Table],
×
38
    table_name: &str,
×
39
) -> Result<&'a Table, ObjectStoreConnectorError> {
×
40
    tables.iter().find(|table| table.name == table_name).ok_or(
×
41
        ObjectStoreConnectorError::DataFusionStorageObjectError(
×
42
            ObjectStoreObjectError::TableDefinitionNotFound,
×
43
        ),
×
44
    )
×
45
}
×
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