Skip to content

Commit

Permalink
refactor parquet extractor backfill support function
Browse files Browse the repository at this point in the history
  • Loading branch information
yuunlimm committed Nov 20, 2024
1 parent e3795ed commit be7a2e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,7 @@ impl Processable for ParquetDefaultExtractor {
];

// Populate the map based on opt-in tables
for (table_flag, enum_type, data) in data_types {
add_to_map_if_opted_in_for_backfill(
self.opt_in_tables,
&mut map,
table_flag,
enum_type,
data,
);
}
add_to_map_if_opted_in_for_backfill(self.opt_in_tables, &mut map, data_types.to_vec());

Check warning on line 102 in rust/sdk-processor/src/steps/parquet_default_processor/parquet_default_extractor.rs

View check run for this annotation

Codecov / codecov/patch

rust/sdk-processor/src/steps/parquet_default_processor/parquet_default_extractor.rs#L102

Added line #L102 was not covered by tests

Ok(Some(TransactionContext {
data: map,
Expand Down
11 changes: 5 additions & 6 deletions rust/sdk-processor/src/utils/parquet_extractor_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use std::collections::HashMap;
pub fn add_to_map_if_opted_in_for_backfill(
opt_in_tables: TableFlags,
map: &mut HashMap<ParquetTypeEnum, ParquetTypeStructs>,
table_flag: TableFlags,
enum_type: ParquetTypeEnum,
data: ParquetTypeStructs,
data_types: Vec<(TableFlags, ParquetTypeEnum, ParquetTypeStructs)>,

Check warning on line 9 in rust/sdk-processor/src/utils/parquet_extractor_helper.rs

View check run for this annotation

Codecov / codecov/patch

rust/sdk-processor/src/utils/parquet_extractor_helper.rs#L9

Added line #L9 was not covered by tests
) {
// Add to map if all tables are opted-in (empty) or if the specific flag is set
if opt_in_tables.is_empty() || opt_in_tables.contains(table_flag) {
map.insert(enum_type, data);
for (table_flag, enum_type, data) in data_types {
if opt_in_tables.is_empty() || opt_in_tables.contains(table_flag) {
map.insert(enum_type, data);
}

Check warning on line 14 in rust/sdk-processor/src/utils/parquet_extractor_helper.rs

View check run for this annotation

Codecov / codecov/patch

rust/sdk-processor/src/utils/parquet_extractor_helper.rs#L11-L14

Added lines #L11 - L14 were not covered by tests
}
}

0 comments on commit be7a2e0

Please sign in to comment.