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

Method FindLast

cpp/src/arrow/json/chunker.cc:140–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 Status FindLast(std::string_view block, int64_t* out_pos) override {
141 const size_t block_length = block.size();
142 size_t consumed_length = 0;
143 while (consumed_length < block_length) {
144 rj::MemoryStream ms(reinterpret_cast<const char*>(block.data()), block.size());
145 using InputStream = rj::EncodedInputStream<rj::UTF8<>, rj::MemoryStream>;
146 auto length = ConsumeWholeObject(InputStream(ms));
147 if (length == string_view::npos || length == 0) {
148 // found incomplete object or block is empty
149 break;
150 }
151 consumed_length += length;
152 block = block.substr(length);
153 }
154 if (consumed_length == 0) {
155 *out_pos = -1;
156 } else {
157 consumed_length += ConsumeWhitespace(block);
158 DCHECK_LE(consumed_length, block_length);
159 *out_pos = static_cast<int64_t>(consumed_length);
160 }
161 return Status::OK();
162 }
163
164 Status FindNth(std::string_view partial, std::string_view block, int64_t count,
165 int64_t* out_pos, int64_t* num_found) override {

Callers

nothing calls this directly

Calls 7

ConsumeWhitespaceFunction · 0.85
substrMethod · 0.80
ConsumeWholeObjectFunction · 0.70
OKFunction · 0.70
InputStreamClass · 0.50
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected