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

Function list_difference

src/backend/nodes/list.c:1156–1176  ·  view source on GitHub ↗

* Return a list that contains all the cells in list1 that are not in * list2. The returned list is freshly allocated via palloc(), but the * cells themselves point to the same objects as the cells of the * input lists. * * This variant works on lists of pointers, and determines list * membership via equal() */

Source from the content-addressed store, hash-verified

1154 * membership via equal()
1155 */
1156List *
1157list_difference(const List *list1, const List *list2)
1158{
1159 const ListCell *cell;
1160 List *result = NIL;
1161
1162 Assert(IsPointerList(list1));
1163 Assert(IsPointerList(list2));
1164
1165 if (list2 == NIL)
1166 return list_copy(list1);
1167
1168 foreach(cell, list1)
1169 {
1170 if (!list_member(list2, lfirst(cell)))
1171 result = lappend(result, lfirst(cell));
1172 }
1173
1174 check_list_invariants(result);
1175 return result;
1176}
1177
1178/*
1179 * This variant of list_difference() determines list membership via

Callers 10

is_exprs_nullableFunction · 0.85
create_tidscan_planFunction · 0.85
create_mergejoin_planFunction · 0.85
create_hashjoin_planFunction · 0.85
aqumv_process_from_qualsFunction · 0.85
groupby_query_rewriteFunction · 0.85
process_duplicate_orsFunction · 0.85
infer_arbiter_indexesFunction · 0.85

Calls 5

list_copyFunction · 0.85
list_memberFunction · 0.85
lappendFunction · 0.85
check_list_invariantsFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected