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

Function bms_intersect

src/backend/nodes/bitmapset.c:255–282  ·  view source on GitHub ↗

* bms_intersect - set intersection */

Source from the content-addressed store, hash-verified

253 * bms_intersect - set intersection
254 */
255Bitmapset *
256bms_intersect(const Bitmapset *a, const Bitmapset *b)
257{
258 Bitmapset *result;
259 const Bitmapset *other;
260 int resultlen;
261 int i;
262
263 /* Handle cases where either input is NULL */
264 if (a == NULL || b == NULL)
265 return NULL;
266 /* Identify shorter and longer input; copy the shorter one */
267 if (a->nwords <= b->nwords)
268 {
269 result = bms_copy(a);
270 other = b;
271 }
272 else
273 {
274 result = bms_copy(b);
275 other = a;
276 }
277 /* And intersect the longer input with the result */
278 resultlen = result->nwords;
279 for (i = 0; i < resultlen; i++)
280 result->words[i] &= other->words[i];
281 return result;
282}
283
284/*
285 * bms_difference - set difference (ie, A without members of B)

Callers 15

InitResGroupsFunction · 0.85
validateCapabilitiesFunction · 0.85
initplan_walkerFunction · 0.85
UpdateChangedParamSetFunction · 0.85
ExecFindMatchingSubPlansFunction · 0.85
set_param_referencesFunction · 0.85
make_outerjoininfoFunction · 0.85
process_equivalenceFunction · 0.85
get_eclass_for_sort_exprFunction · 0.85

Calls 1

bms_copyFunction · 0.85

Tested by

no test coverage detected