Skip to content

Commit

Permalink
refactor parquet extractor backfill support function (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuunlimm authored Nov 21, 2024
1 parent e3795ed commit 3d22e3b
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());

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)>,
) {
// 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);
}
}
}

0 comments on commit 3d22e3b

Please sign in to comment.