Skip to content

Commit

Permalink
perf(select): Use byte records instead of string records (#892)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Wagner <[email protected]>
  • Loading branch information
nwagner84 authored Dec 16, 2024
1 parent 5656ad6 commit 86260d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/pica-cli/src/commands/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl Select {
let mut reader =
ReaderBuilder::new().from_path(filename)?;

while let Some(result) = reader.next_string_record() {
while let Some(result) = reader.next_byte_record() {
match result {
Err(e) if e.skip_parse_err(skip_invalid) => {
progress.update(true);
Expand All @@ -221,7 +221,7 @@ impl Select {
Ok(ref record) => {
progress.update(false);

if !filter_set.check(record.ppn().into()) {
if !filter_set.check(record.ppn()) {
continue;
}

Expand All @@ -236,7 +236,7 @@ impl Select {
let outcome = record.query(&query, &options);
for row in outcome.iter() {
if self.no_empty_columns
&& row.iter().any(String::is_empty)
&& row.iter().any(|e| e.is_empty())
{
continue;
}
Expand All @@ -253,7 +253,7 @@ impl Select {
seen.insert(hash);
}

if !row.iter().all(String::is_empty) {
if !row.iter().all(|e| e.is_empty()) {
if self.nf.is_none() {
writer.write_record(row)?;
} else {
Expand All @@ -262,7 +262,7 @@ impl Select {
(crate::translit::translit(
self.nf.as_ref(),
))(
s
s.to_string()
)
}),
)?;
Expand Down

0 comments on commit 86260d5

Please sign in to comment.