LQPNPtr Translator::passJoins(const Node *ast, size_t depthOperator)
{
checkDepthOperator(depthOperator);
// Left part holding result of join constantly but initially it empty
LQPNPtr left;
// Loop for joining all inputs consequentially. Left joining part can be joined previously or
// empty nodes. Right part will be joined to left on every iteration.
BOOST_FOREACH(Node *joinItem, ast->getList())
{
LQPNPtr right = passJoinItem(joinItem, depthOperator+1);
// If we on first iteration - right part turning into left, otherwise left and right parts
// joining and left part turning into join result.
if (!left)
{
left = right;
}
else
{
LQPNPtr node = make_shared<LogicalQueryPlanNode>(newParsingContext(joinItem),
OperatorLibrary::getInstance()->createLogicalOperator("join"));
node->addChild(left);
node->addChild(right);
left = node;
}
}
//Check JOIN with its inferring
try
{
left->inferTypes(_qry);
}
catch(const Exception &e)
{
fail(CONV_TO_USER_QUERY_EXCEPTION(e, newParsingContext(ast)));
}
// Ok, return join result
return left;
}
join执行
最新推荐文章于 2024-03-20 10:13:07 发布