MCPcopy Create free account
hub / github.com/bytedance/bolt / printNonNull

Method printNonNull

bolt/vector/VectorPrinter.cpp:183–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182 protected:
183 std::string printNonNull(vector_size_t index, const std::string& indent)
184 const override {
185 std::stringstream out;
186
187 auto mapVector = decoded_.base()->as<MapVector>();
188 auto mapIndex = decoded_.index(index);
189
190 const auto& keys = children_[0];
191 const auto& values = children_[1];
192
193 auto offset = mapVector->offsetAt(mapIndex);
194 auto size = mapVector->sizeAt(mapIndex);
195
196 auto newIndent = addIndent(indent);
197
198 bool fixedWidthKey = mapVector->type()->childAt(0)->isFixedWidth();
199 bool fixedWidthValue = mapVector->type()->childAt(1)->isFixedWidth();
200
201 for (auto i = 0; i < size; ++i) {
202 if (fixedWidthKey) {
203 out << indent << "Key " << i << ": "
204 << printFixedWidth(keys->decoded(), offset + i) << std::endl;
205 } else {
206 out << indent << "Key " << i << ": " << values->summarize(offset + i)
207 << std::endl;
208 out << keys->print(offset + i, newIndent);
209 }
210
211 if (fixedWidthValue) {
212 out << indent << "Value " << i << ": "
213 << printFixedWidth(values->decoded(), offset + i) << std::endl;
214 } else {
215 out << indent << "Value " << i << ": " << values->summarize(offset + i)
216 << std::endl;
217 out << values->print(offset + i, newIndent);
218 }
219 }
220
221 return out.str();
222 }
223
224 std::string summarizeNonNull(vector_size_t index) const override {
225 auto* base = decoded_.base();

Callers

nothing calls this directly

Calls 12

addIndentFunction · 0.85
printFixedWidthFunction · 0.85
offsetAtMethod · 0.80
sizeAtMethod · 0.80
isFixedWidthMethod · 0.80
childAtMethod · 0.80
summarizeMethod · 0.80
strMethod · 0.80
baseMethod · 0.45
indexMethod · 0.45
typeMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected