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

Function stringifyTruncatedElementList

bolt/vector/ComplexVector.cpp:45–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43constexpr vector_size_t kMaxElementsInToString = 5;
44
45std::string stringifyTruncatedElementList(
46 vector_size_t start,
47 vector_size_t size,
48 vector_size_t limit,
49 std::string_view delimiter,
50 const std::function<void(std::stringstream&, vector_size_t)>&
51 stringifyElementCB) {
52 std::stringstream out;
53 if (size == 0) {
54 return "<empty>";
55 }
56 out << size << " elements starting at " << start << " {";
57
58 const vector_size_t limitedSize = std::min(size, limit);
59 for (vector_size_t i = 0; i < limitedSize; ++i) {
60 if (i > 0) {
61 out << delimiter;
62 }
63 stringifyElementCB(out, start + i);
64 }
65
66 if (size > limitedSize) {
67 if (limitedSize) {
68 out << delimiter;
69 }
70 out << "...";
71 }
72 out << "}";
73 return out.str();
74}
75
76// static
77std::shared_ptr<RowVector> RowVector::createEmpty(

Callers 2

toStringMethod · 0.85
TESTFunction · 0.85

Calls 2

strMethod · 0.80
minFunction · 0.50

Tested by 1

TESTFunction · 0.68