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

Method createRow

bolt/vector/tests/VectorTest.cpp:156–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 }
155
156 VectorPtr createRow(int32_t numRows, bool withNulls) {
157 auto childType =
158 ROW({"child_bigint", "child_string"}, {BIGINT(), VARCHAR()});
159 auto parentType =
160 ROW({"parent_bigint", "parent_row"}, {BIGINT(), childType});
161 auto baseRow = BaseVector::create(parentType, numRows, pool());
162 auto row = baseRow->as<RowVector>();
163 EXPECT_EQ(row->size(), numRows);
164 EXPECT_EQ(row->nulls(), nullptr);
165
166 std::vector<VectorPtr> nested = {
167 createScalar<TypeKind::BIGINT>(BIGINT(), numRows, withNulls),
168 createScalar<TypeKind::VARCHAR>(VARCHAR(), numRows, withNulls)};
169 auto childRow = std::make_shared<RowVector>(
170 pool(),
171 childType,
172 BufferPtr(nullptr),
173 numRows,
174 std::move(nested),
175 0 /*nullCount*/);
176 BufferPtr nulls;
177 if (withNulls) {
178 nulls = allocateNulls(numRows, pool());
179 auto rawNulls = nulls->asMutable<uint64_t>();
180 for (int32_t i = 0; i < numRows; ++i) {
181 bits::setNull(rawNulls, i, i % 8 == 0);
182 }
183 }
184 std::vector<VectorPtr> parentFields = {
185 createScalar<TypeKind::BIGINT>(BIGINT(), numRows, withNulls), childRow};
186 return std::make_shared<RowVector>(
187 pool(),
188 parentType,
189 nulls,
190 numRows,
191 std::move(parentFields),
192 BaseVector::countNulls(nulls, numRows));
193 }
194
195 int32_t createRepeated(
196 int32_t numRows,

Callers

nothing calls this directly

Calls 8

ROWFunction · 0.85
allocateNullsFunction · 0.85
createFunction · 0.50
poolFunction · 0.50
setNullFunction · 0.50
countNullsFunction · 0.50
sizeMethod · 0.45
nullsMethod · 0.45

Tested by

no test coverage detected