MCPcopy Create free account
hub / github.com/apache/cloudberry / splitJoinQualExpr

Function splitJoinQualExpr

src/backend/executor/nodeNestloop.c:673–718  ·  view source on GitHub ↗

---------------------------------------------------------------- * splitJoinQualExpr * * Deconstruct the join clauses into outer and inner argument values, so * that we can evaluate those subexpressions separately. Note: for constant * expression we don't need to split (MPP-21294). However, if constant expressions * have peer splittable expressions we *do* split those. * * This is used for

Source from the content-addressed store, hash-verified

671 * ----------------------------------------------------------------
672 */
673static void
674splitJoinQualExpr(List *joinqual, List **inner_join_keys_p, List **outer_join_keys_p)
675{
676 List *lclauses = NIL;
677 List *rclauses = NIL;
678 ListCell *lc;
679
680 foreach(lc, joinqual)
681 {
682 Expr *expr = (Expr *) lfirst(lc);
683
684 switch (expr->type)
685 {
686 case T_FuncExpr:
687 case T_OpExpr:
688 extractFuncExprArgs(expr, &lclauses, &rclauses);
689 break;
690
691 case T_BoolExpr:
692 {
693 BoolExpr *bexpr = (BoolExpr *) expr;
694 ListCell *argslc;
695
696 foreach(argslc, bexpr->args)
697 {
698 extractFuncExprArgs(lfirst(argslc), &lclauses, &rclauses);
699 }
700 }
701 break;
702
703 case T_Const:
704 /*
705 * Constant expressions do not need to be splitted into left and
706 * right as they don't need to be considered for NULL value special
707 * cases
708 */
709 break;
710
711 default:
712 elog(ERROR, "unexpected expression type in NestLoopJoin qual");
713 }
714 }
715
716 *inner_join_keys_p = rclauses;
717 *outer_join_keys_p = lclauses;
718}
719
720
721/* ----------------------------------------------------------------

Callers 1

ExecInitNestLoopFunction · 0.85

Calls 2

extractFuncExprArgsFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected