| 186 | } |
| 187 | |
| 188 | std::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 |
no test coverage detected