Applies fn to each row read from reader. Returns the number of rows read.
| 41 | typedef std::function<Status(const string&)> TupleCacheRowFunction; |
| 42 | // Applies fn to each row read from reader. Returns the number of rows read. |
| 43 | static Status ForEachRow( |
| 44 | TupleTextFileReader* reader, TupleCacheRowFunction& fn, int64_t* row_count) { |
| 45 | DCHECK(reader != nullptr); |
| 46 | DCHECK(row_count != nullptr); |
| 47 | bool eos = false; |
| 48 | int64_t num_rows = 0; |
| 49 | Status read_status; |
| 50 | string row_str; |
| 51 | do { |
| 52 | RETURN_IF_ERROR(reader->GetNext(&row_str, &eos)); |
| 53 | RETURN_IF_ERROR(fn(row_str)); |
| 54 | num_rows++; |
| 55 | } while (!eos); |
| 56 | *row_count = num_rows; |
| 57 | return Status::OK(); |
| 58 | } |
| 59 | |
| 60 | static Status VerifyRowsFromComparisonFile(const string& ref_file_path, |
| 61 | ReferenceRowsMap& cache, TupleTextFileReader* reader, int64_t* row_count) { |
no test coverage detected