MCPcopy Create free account
hub / github.com/apache/arrow / ProcessFinal

Method ProcessFinal

cpp/src/arrow/util/delimiting.cc:148–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148Status Chunker::ProcessFinal(std::shared_ptr<Buffer> partial,
149 std::shared_ptr<Buffer> block,
150 std::shared_ptr<Buffer>* completion,
151 std::shared_ptr<Buffer>* rest) {
152 if (partial->size() == 0) {
153 // If partial is empty, don't bother looking for completion
154 *completion = SliceBuffer(block, 0, 0);
155 *rest = block;
156 return Status::OK();
157 }
158 int64_t first_pos = -1;
159 RETURN_NOT_OK(boundary_finder_->FindFirst(std::string_view(*partial),
160 std::string_view(*block), &first_pos));
161 if (first_pos == BoundaryFinder::kNoDelimiterFound) {
162 // No delimiter in block => it's entirely a completion of partial
163 *completion = block;
164 *rest = SliceBuffer(std::move(block), 0, 0);
165 } else {
166 *completion = SliceBuffer(block, 0, first_pos);
167 *rest = SliceBuffer(std::move(block), first_pos);
168 }
169 return Status::OK();
170}
171
172Status Chunker::ProcessSkip(std::shared_ptr<Buffer> partial,
173 std::shared_ptr<Buffer> block, bool final, int64_t* count,

Callers 4

AssertChunkingBlockSizeFunction · 0.80
operator()Method · 0.80
operator()Method · 0.80
operator()Method · 0.80

Calls 4

SliceBufferFunction · 0.85
OKFunction · 0.50
sizeMethod · 0.45
FindFirstMethod · 0.45

Tested by 1

AssertChunkingBlockSizeFunction · 0.64