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

Function initialize_mergeclause_eclasses

src/backend/optimizer/path/pathkeys.c:1782–1819  ·  view source on GitHub ↗

* initialize_mergeclause_eclasses * Set the EquivalenceClass links in a mergeclause restrictinfo. * * RestrictInfo contains fields in which we may cache pointers to * EquivalenceClasses for the left and right inputs of the mergeclause. * (If the mergeclause is a true equivalence clause these will be the * same EquivalenceClass, otherwise not.) If the mergeclause is either * used to genera

Source from the content-addressed store, hash-verified

1780 * they've been updated to point to canonical ECs.
1781 */
1782void
1783initialize_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo)
1784{
1785 Expr *clause = restrictinfo->clause;
1786 Oid lefttype,
1787 righttype;
1788
1789 /* Should be a mergeclause ... */
1790 Assert(restrictinfo->mergeopfamilies != NIL);
1791 /* ... with links not yet set */
1792 Assert(restrictinfo->left_ec == NULL);
1793 Assert(restrictinfo->right_ec == NULL);
1794
1795 /* Need the declared input types of the operator */
1796 op_input_types(((OpExpr *) clause)->opno, &lefttype, &righttype);
1797
1798 /* Find or create a matching EquivalenceClass for each side */
1799 restrictinfo->left_ec =
1800 get_eclass_for_sort_expr(root,
1801 (Expr *) get_leftop(clause),
1802 restrictinfo->nullable_relids,
1803 restrictinfo->mergeopfamilies,
1804 lefttype,
1805 ((OpExpr *) clause)->inputcollid,
1806 0,
1807 NULL,
1808 true);
1809 restrictinfo->right_ec =
1810 get_eclass_for_sort_expr(root,
1811 (Expr *) get_rightop(clause),
1812 restrictinfo->nullable_relids,
1813 restrictinfo->mergeopfamilies,
1814 righttype,
1815 ((OpExpr *) clause)->inputcollid,
1816 0,
1817 NULL,
1818 true);
1819}
1820
1821/*
1822 * update_mergeclause_eclasses

Callers 2

distribute_qual_to_relsFunction · 0.85
gen_implied_qualFunction · 0.85

Calls 4

op_input_typesFunction · 0.85
get_eclass_for_sort_exprFunction · 0.85
get_leftopFunction · 0.85
get_rightopFunction · 0.85

Tested by

no test coverage detected