| 170 | } |
| 171 | |
| 172 | Status Chunker::ProcessSkip(std::shared_ptr<Buffer> partial, |
| 173 | std::shared_ptr<Buffer> block, bool final, int64_t* count, |
| 174 | std::shared_ptr<Buffer>* rest) { |
| 175 | DCHECK_GT(*count, 0); |
| 176 | int64_t pos; |
| 177 | int64_t num_found; |
| 178 | ARROW_RETURN_NOT_OK(boundary_finder_->FindNth( |
| 179 | std::string_view(*partial), std::string_view(*block), *count, &pos, &num_found)); |
| 180 | if (pos == BoundaryFinder::kNoDelimiterFound) { |
| 181 | return StraddlingTooLarge(); |
| 182 | } |
| 183 | if (ARROW_PREDICT_FALSE(final && *count > num_found && block->size() != pos)) { |
| 184 | // Skip the last row in the final block which does not have a delimiter |
| 185 | ++num_found; |
| 186 | *rest = SliceBuffer(std::move(block), 0, 0); |
| 187 | } else { |
| 188 | *rest = SliceBuffer(std::move(block), pos); |
| 189 | } |
| 190 | *count -= num_found; |
| 191 | return Status::OK(); |
| 192 | } |
| 193 | |
| 194 | } // namespace arrow |