| 530 | return ROW(std::move(names), std::move(types)); |
| 531 | } |
| 532 | } // namespace |
| 533 | |
| 534 | ExpandNode::ExpandNode( |
| 535 | PlanNodeId id, |
| 536 | std::vector<std::vector<TypedExprPtr>> projections, |
| 537 | std::vector<std::string> names, |
| 538 | PlanNodePtr source) |
| 539 | : PlanNode(std::move(id)), |
| 540 | sources_{source}, |
| 541 | outputType_(getExpandOutputType(projections, std::move(names))), |
| 542 | projections_(std::move(projections)) { |
| 543 | const auto& projectionNames = outputType_->names(); |
| 544 | const auto numColumns = projectionNames.size(); |
| 545 | const auto numRows = projections_.size(); |
| 546 | |
| 547 | for (const auto& rowProjection : projections_) { |
| 548 | for (const auto& columnProjection : rowProjection) { |
| 549 | BOLT_USER_CHECK( |
| 550 | TypedExprs::isFieldAccess(columnProjection) || |
| 551 | TypedExprs::isConstant(columnProjection), |
| 552 | "Unsupported projection expression in Expand plan node. Expected field reference or constant. Got: {} ", |
| 553 | columnProjection->toString()); |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | for (int i = 0; i < numColumns; ++i) { |
| 558 | const auto& type = outputType_->childAt(i); |
| 559 | for (int j = 1; j < numRows; ++j) { |
| 560 | BOLT_USER_CHECK( |
| 561 | projections_[j][i]->type()->equivalent(*type), |
| 562 | "The projections type does not match across different rows in the same column. Got: {}, {}", |
| 563 | projections_[j][i]->type()->toString(), |
| 564 | type->toString()); |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 |
nothing calls this directly
no test coverage detected