Unverified Commit a926d4fe authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

consolidate duplicate conditions in TextReader (#4530)

parent 981853b1
......@@ -198,8 +198,10 @@ class TextReader {
[&filter_fun, &out_used_data_indices, this]
(INDEX_T line_idx , const char* buffer, size_t size) {
bool is_used = filter_fun(line_idx);
if (is_used) { out_used_data_indices->push_back(line_idx); }
if (is_used) { lines_.emplace_back(buffer, size); }
if (is_used) {
out_used_data_indices->push_back(line_idx);
lines_.emplace_back(buffer, size);
}
});
return total_cnt;
}
......@@ -213,8 +215,8 @@ class TextReader {
&out_sampled_data]
(INDEX_T line_idx, const char* buffer, size_t size) {
bool is_used = filter_fun(line_idx);
if (is_used) { out_used_data_indices->push_back(line_idx); }
if (is_used) {
out_used_data_indices->push_back(line_idx);
if (cur_sample_cnt < sample_cnt) {
out_sampled_data->emplace_back(buffer, size);
++cur_sample_cnt;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment