Skip to content

Commit

Permalink
refactor: get_stats_records helper to ignore dataset-level stats an…
Browse files Browse the repository at this point in the history
…d use simd_json instead of serde_json
  • Loading branch information
jqnatividad committed Nov 19, 2024
1 parent 85c330b commit 12bdfff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1968,10 +1968,17 @@ pub fn get_stats_records(
let statsdata_lines = statsdata_reader.lines();

let mut line: String;
let mut s_slice: Vec<u8>;
for curr_line in statsdata_lines {
line = curr_line?;
let stats_record: StatsData = serde_json::from_str(&line)?;
csv_stats.push(stats_record);
// do not load dataset-level stats into csv_stats
if !line.starts_with(r#"{"field":"_qsv_"#) {
s_slice = line.as_bytes().to_vec();
match simd_json::serde::from_slice(&mut **&mut s_slice) {
Ok(stats) => csv_stats.push(stats),
Err(_) => continue,
}
}
}
stats_data_loaded = true;
}
Expand Down

0 comments on commit 12bdfff

Please sign in to comment.