Skip to content

Commit abcd365

Browse files
committed
refactor: count so we confirm zero rowcount
1 parent 2febde3 commit abcd365

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cmd/count.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
157157
count_input(&conf, count_delims_mode)?
158158
} else {
159159
let count = polars_count_input(&conf, args.flag_low_memory)?;
160-
(count, empty_record_stats)
160+
// if polars count returns a zero, do a regular CSV reader count
161+
// to be doubly sure as it will be cheap to do so with the regular count
162+
if count == 0 {
163+
count_input(&conf, count_delims_mode)?
164+
} else {
165+
(count, empty_record_stats)
166+
}
161167
}
162168

163169
#[cfg(not(feature = "polars"))]

0 commit comments

Comments
 (0)