Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rust): use wrapping_add in csv line snooping #15109

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/polars-io/src/csv/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub(crate) fn next_line_position(
if rejected_line_groups >= 3 {
return None;
}
lines_checked += 1;
lines_checked = lines_checked.wrapping_add(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we decrement expected fields at 256 lines, and afterwards we decrement it every 65536 lines? Since lines_checked is a u16.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. Should probably just use u8 here.

// headers might have an extra value
// So if we have churned through enough lines
// we try one field less.
Expand Down
Loading