MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / getPhysicalPlan

Method getPhysicalPlan

src/function/table/table_function.cpp:89–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89std::unique_ptr<PhysicalOperator> TableFunction::getPhysicalPlan(PlanMapper* planMapper,
90 const LogicalOperator* logicalOp) {
91 std::vector<DataPos> outPosV;
92 auto& call = logicalOp->constCast<LogicalTableFunctionCall>();
93 auto outSchema = call.getSchema();
94 for (auto& expr : call.getBindData()->columns) {
95 outPosV.emplace_back(planMapper->getDataPos(*expr, *outSchema));
96 }
97 auto info = TableFunctionCallInfo();
98 info.function = call.getTableFunc();
99 info.bindData = call.getBindData()->copy();
100 info.outPosV = outPosV;
101 auto initInput =
102 TableFuncInitSharedStateInput(info.bindData.get(), planMapper->executionContext);
103 auto sharedState = info.function.initSharedStateFunc(initInput);
104 // Filter columns for print info based on column skips
105 binder::expression_vector printExprs;
106 auto columnSkips = call.getBindData()->getColumnSkips();
107 for (auto i = 0u; i < call.getBindData()->columns.size(); ++i) {
108 if (columnSkips.empty() || !columnSkips[i]) {
109 printExprs.push_back(call.getBindData()->columns[i]);
110 }
111 }
112 auto desc = call.getBindData()->getDescription();
113 auto printInfo = std::make_unique<TableFunctionCallPrintInfo>(
114 desc.empty() ? call.getTableFunc().name : desc, printExprs);
115 return std::make_unique<TableFunctionCall>(std::move(info), sharedState,
116 planMapper->getOperatorID(), std::move(printInfo));
117}
118
119offset_t TableFunction::emptyTableFunc(const TableFuncInput&, TableFuncOutput&) {
120 // DO NOTHING.

Callers

nothing calls this directly

Calls 13

emplace_backMethod · 0.80
getTableFuncMethod · 0.80
getColumnSkipsMethod · 0.80
getOperatorIDMethod · 0.80
getBindDataMethod · 0.45
getDataPosMethod · 0.45
copyMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected