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

Function combineInputColumns

bolt/python/Utils.cpp:188–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188std::shared_ptr<RowVector> combineInputColumns(
189 const std::vector<VectorPtr>& args,
190 const exec::EvalCtx& context) {
191 std::vector<std::string> names;
192 std::vector<VectorPtr> children;
193
194 for (size_t i = 0; i < args.size(); ++i) {
195 const auto& arg = args[i];
196 if (arg) {
197 arg->loadedVector();
198 children.push_back(arg);
199
200 std::string name;
201 if (context.row()) {
202 long long address = (long long)arg.get();
203 for (size_t j = 0; j < context.row()->childrenSize(); ++j) {
204 auto cur = context.row()->children()[j];
205 if ((long long)cur.get() == address) {
206 name = context.row()->type()->asRow().nameOf(j);
207 break;
208 }
209 }
210 }
211
212 if (name.empty()) {
213 name = fmt::format("col_{}", i);
214 }
215 names.push_back(name);
216 }
217 }
218
219 if (children.empty()) {
220 return RowVector::createEmpty({}, context.pool());
221 }
222
223 vector_size_t length = children[0]->size();
224
225 std::vector<TypePtr> types;
226 for (const auto& child : children) {
227 types.push_back(child->type());
228 }
229 auto rowType = ROW(move(names), move(types));
230
231 return std::make_shared<RowVector>(
232 context.pool(), rowType, nullptr, length, children, 0);
233}
234} // namespace bolt::python

Callers 1

applyMethod · 0.85

Calls 13

createEmptyFunction · 0.85
ROWFunction · 0.85
sizeMethod · 0.45
loadedVectorMethod · 0.45
push_backMethod · 0.45
rowMethod · 0.45
getMethod · 0.45
childrenSizeMethod · 0.45
childrenMethod · 0.45
nameOfMethod · 0.45
typeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected