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

Function build_expression_pathkey

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

* build_expression_pathkey * Build a pathkeys list that describes an ordering by a single expression * using the given sort operator. * * expr, nullable_relids, and rel are as for make_pathkey_from_sortinfo. * We induce the other arguments assuming default sort order for the operator. * * Similarly to make_pathkey_from_sortinfo, the result is NIL if create_it * is false and the express

Source from the content-addressed store, hash-verified

1108 * is false and the expression isn't already in some EquivalenceClass.
1109 */
1110List *
1111build_expression_pathkey(PlannerInfo *root,
1112 Expr *expr,
1113 Relids nullable_relids,
1114 Oid opno,
1115 Relids rel,
1116 bool create_it)
1117{
1118 List *pathkeys;
1119 Oid opfamily,
1120 opcintype;
1121 int16 strategy;
1122 PathKey *cpathkey;
1123
1124 /* Find the operator in pg_amop --- failure shouldn't happen */
1125 if (!get_ordering_op_properties(opno,
1126 &opfamily, &opcintype, &strategy))
1127 elog(ERROR, "operator %u is not a valid ordering operator",
1128 opno);
1129
1130 cpathkey = make_pathkey_from_sortinfo(root,
1131 expr,
1132 nullable_relids,
1133 opfamily,
1134 opcintype,
1135 exprCollation((Node *) expr),
1136 (strategy == BTGreaterStrategyNumber),
1137 (strategy == BTGreaterStrategyNumber),
1138 0,
1139 rel,
1140 create_it);
1141
1142 if (cpathkey)
1143 pathkeys = list_make1(cpathkey);
1144 else
1145 pathkeys = NIL;
1146
1147 return pathkeys;
1148}
1149
1150/*
1151 * convert_subquery_pathkeys

Callers 1

set_function_pathlistFunction · 0.85

Calls 3

exprCollationFunction · 0.85

Tested by

no test coverage detected