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

Function GetExistingLocalJoinPath

src/backend/foreign/foreign.c:1019–1105  ·  view source on GitHub ↗

* Get a copy of an existing local path for a given join relation. * * This function is usually helpful to obtain an alternate local path for EPQ * checks. * * Right now, this function only supports unparameterized foreign joins, so we * only search for unparameterized path in the given list of paths. Since we * are searching for a path which can be used to construct an alternative local *

Source from the content-addressed store, hash-verified

1017 * choose the most efficient path, which is all for the best.
1018 */
1019Path *
1020GetExistingLocalJoinPath(RelOptInfo *joinrel)
1021{
1022 ListCell *lc;
1023
1024 Assert(IS_JOIN_REL(joinrel));
1025
1026 foreach(lc, joinrel->pathlist)
1027 {
1028 Path *path = (Path *) lfirst(lc);
1029 JoinPath *joinpath = NULL;
1030
1031 /* Skip parameterized paths. */
1032 if (path->param_info != NULL)
1033 continue;
1034
1035 switch (path->pathtype)
1036 {
1037 case T_HashJoin:
1038 {
1039 HashPath *hash_path = makeNode(HashPath);
1040
1041 memcpy(hash_path, path, sizeof(HashPath));
1042 joinpath = (JoinPath *) hash_path;
1043 }
1044 break;
1045
1046 case T_NestLoop:
1047 {
1048 NestPath *nest_path = makeNode(NestPath);
1049
1050 memcpy(nest_path, path, sizeof(NestPath));
1051 joinpath = (JoinPath *) nest_path;
1052 }
1053 break;
1054
1055 case T_MergeJoin:
1056 {
1057 MergePath *merge_path = makeNode(MergePath);
1058
1059 memcpy(merge_path, path, sizeof(MergePath));
1060 joinpath = (JoinPath *) merge_path;
1061 }
1062 break;
1063
1064 default:
1065
1066 /*
1067 * Just skip anything else. We don't know if corresponding
1068 * plan would build the output row from whole-row references
1069 * of base relations and execute the EPQ checks.
1070 */
1071 break;
1072 }
1073
1074 /* This path isn't good for us, check next. */
1075 if (!joinpath)
1076 continue;

Callers 1

Calls 1

foreachFunction · 0.50

Tested by

no test coverage detected