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

Function cdbpathlocus_is_valid

src/backend/cdb/cdbpathlocus.c:1179–1219  ·  view source on GitHub ↗

* cdbpathlocus_is_valid * * Returns true if locus appears structurally valid. */

Source from the content-addressed store, hash-verified

1177 * Returns true if locus appears structurally valid.
1178 */
1179bool
1180cdbpathlocus_is_valid(CdbPathLocus locus)
1181{
1182 ListCell *distkeycell;
1183
1184 if (!CdbLocusType_IsValid(locus.locustype))
1185 goto bad;
1186
1187 if (!CdbPathLocus_IsHashedWorkers(locus)&& !CdbPathLocus_IsHashed(locus) && !CdbPathLocus_IsHashedOJ(locus) && locus.distkey != NIL)
1188 goto bad;
1189
1190 if (CdbPathLocus_IsHashedWorkers(locus) || CdbPathLocus_IsHashed(locus) || CdbPathLocus_IsHashedOJ(locus))
1191 {
1192 if (locus.distkey == NIL)
1193 goto bad;
1194 if (!IsA(locus.distkey, List))
1195 goto bad;
1196 foreach(distkeycell, locus.distkey)
1197 {
1198 DistributionKey *item = (DistributionKey *) lfirst(distkeycell);
1199
1200 if (!item || !IsA(item, DistributionKey))
1201 goto bad;
1202
1203 if (!OidIsValid(item->dk_opfamily))
1204 goto bad;
1205 }
1206 }
1207
1208 /* Check that 'numsegments' is valid */
1209 if (!CdbPathLocus_IsGeneral(locus) &&
1210 !CdbPathLocus_IsEntry(locus) &&
1211 !CdbPathLocus_IsOuterQuery(locus) &&
1212 locus.numsegments == -1)
1213 goto bad;
1214
1215 return true;
1216
1217bad:
1218 return false;
1219} /* cdbpathlocus_is_valid */
1220
1221/*
1222 * cdbpathlocus_parallel_join

Calls 1

foreachFunction · 0.50

Tested by

no test coverage detected