| 69 | |
| 70 | template <typename Visitor> |
| 71 | Status VisitColumn(int32_t col_index, int64_t first_row, Visitor&& visit) const { |
| 72 | using detail::ParsedValueDesc; |
| 73 | |
| 74 | int32_t batch_row = 0; |
| 75 | size_t missing_index = 0; |
| 76 | for (size_t buf_index = 0; buf_index < values_buffers_.size(); ++buf_index) { |
| 77 | const auto& values_buffer = values_buffers_[buf_index]; |
| 78 | const auto values = reinterpret_cast<const ParsedValueDesc*>(values_buffer->data()); |
| 79 | const auto max_pos = |
| 80 | static_cast<int32_t>(values_buffer->size() / sizeof(ParsedValueDesc)) - 1; |
| 81 | for (int32_t pos = col_index; pos < max_pos; pos += num_cols_, ++batch_row) { |
| 82 | auto start = values[pos].offset; |
| 83 | auto stop = values[pos + 1].offset; |
| 84 | auto quoted = values[pos + 1].quoted; |
| 85 | const bool row_has_missing_fields = |
| 86 | missing_index < missing_fields_.size() && |
| 87 | missing_fields_[missing_index].row == batch_row; |
| 88 | const bool missing = |
| 89 | row_has_missing_fields && |
| 90 | col_index >= missing_fields_[missing_index].first_missing_column; |
| 91 | if (row_has_missing_fields) { |
| 92 | ++missing_index; |
| 93 | } |
| 94 | Status status = visit(parsed_ + start, stop - start, quoted, missing); |
| 95 | if (ARROW_PREDICT_FALSE(!status.ok())) { |
| 96 | return DecorateWithRowNumber(std::move(status), first_row, batch_row); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | return Status::OK(); |
| 101 | } |
| 102 | |
| 103 | template <typename Visitor> |
| 104 | Status VisitLastRow(Visitor&& visit) const { |