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

Method ExpandNode

bolt/core/PlanNode.cpp:532–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530 return ROW(std::move(names), std::move(types));
531}
532} // namespace
533
534ExpandNode::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

Callers

nothing calls this directly

Calls 8

getExpandOutputTypeFunction · 0.85
isConstantFunction · 0.85
childAtMethod · 0.80
namesMethod · 0.45
sizeMethod · 0.45
toStringMethod · 0.45
equivalentMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected