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

Function copy_pathtarget

src/backend/optimizer/util/tlist.c:888–906  ·  view source on GitHub ↗

* copy_pathtarget * Copy a PathTarget. * * The new PathTarget has its own exprs List, but shares the underlying * target expression trees with the old one. */

Source from the content-addressed store, hash-verified

886 * target expression trees with the old one.
887 */
888PathTarget *
889copy_pathtarget(PathTarget *src)
890{
891 PathTarget *dst = makeNode(PathTarget);
892
893 /* Copy scalar fields */
894 memcpy(dst, src, sizeof(PathTarget));
895 /* Shallow-copy the expression list */
896 dst->exprs = list_copy(src->exprs);
897 /* Duplicate sortgrouprefs if any (if not, the memcpy handled this) */
898 if (src->sortgrouprefs)
899 {
900 Size nbytes = list_length(src->exprs) * sizeof(Index);
901
902 dst->sortgrouprefs = (Index *) palloc(nbytes);
903 memcpy(dst->sortgrouprefs, src->sortgrouprefs, nbytes);
904 }
905 return dst;
906}
907
908/*
909 * create_empty_pathtarget

Callers 11

strip_aggdistinctFunction · 0.85
fetch_multi_dqas_infoFunction · 0.85
fetch_single_dqa_infoFunction · 0.85
add_rowid_to_pathFunction · 0.85
make_splitupdate_pathFunction · 0.85
create_one_window_pathFunction · 0.85
create_unique_rowid_pathFunction · 0.85

Calls 3

list_copyFunction · 0.85
list_lengthFunction · 0.85
pallocFunction · 0.50

Tested by

no test coverage detected