* cdbpathlocus_equal * * - Returns false if locus a or locus b is "strewn", meaning that it * cannot be determined whether it is equal to another partitioned * distribution. * * - Returns true if a and b have the same 'locustype' and 'numsegments', * and distribution keys that contain the same equivalence classes. * * - Returns false otherwise. */
| 85 | * - Returns false otherwise. |
| 86 | */ |
| 87 | bool |
| 88 | cdbpathlocus_equal(CdbPathLocus a, CdbPathLocus b) |
| 89 | { |
| 90 | /* Unless a and b have the same numsegments the result is always false */ |
| 91 | if (CdbPathLocus_NumSegments(a) != |
| 92 | CdbPathLocus_NumSegments(b)) |
| 93 | return false; |
| 94 | |
| 95 | /* Unless a and b have the same parallel_workers the result is always false */ |
| 96 | if (CdbPathLocus_NumParallelWorkers(a) != |
| 97 | CdbPathLocus_NumParallelWorkers(b)) |
| 98 | return false; |
| 99 | |
| 100 | /* HashedWorkers will never be equal */ |
| 101 | if (CdbPathLocus_IsHashedWorkers(a) || |
| 102 | CdbPathLocus_IsHashedWorkers(b)) |
| 103 | return false; |
| 104 | |
| 105 | /* SegmentGeneralWorkers will never be equal */ |
| 106 | if (CdbPathLocus_IsSegmentGeneralWorkers(a) || |
| 107 | CdbPathLocus_IsSegmentGeneralWorkers(b)) |
| 108 | return false; |
| 109 | |
| 110 | if (CdbPathLocus_IsStrewn(a) || |
| 111 | CdbPathLocus_IsStrewn(b)) |
| 112 | return false; |
| 113 | |
| 114 | if (CdbPathLocus_IsEqual(a, b)) |
| 115 | return true; |
| 116 | |
| 117 | if (a.distkey == NIL || |
| 118 | b.distkey == NIL || |
| 119 | list_length(a.distkey) != list_length(b.distkey)) |
| 120 | return false; |
| 121 | |
| 122 | if ((CdbPathLocus_IsHashed(a) || CdbPathLocus_IsHashedOJ(a)) && |
| 123 | (CdbPathLocus_IsHashed(b) || CdbPathLocus_IsHashedOJ(b))) |
| 124 | return cdbpath_distkey_equal(a.distkey, b.distkey); |
| 125 | |
| 126 | return false; |
| 127 | } /* cdbpathlocus_equal */ |
| 128 | |
| 129 | /* |
| 130 | * cdb_build_distribution_keys |
no test coverage detected