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

Function AddValue

src/backend/optimizer/util/predtest_valueset.c:180–207  ·  view source on GitHub ↗

* basic operation on PossibleValueSet: add a value to the set field of PossibleValueSet * * The caller must verify that the valueToCopy is greenplum hashable */

Source from the content-addressed store, hash-verified

178 * The caller must verify that the valueToCopy is greenplum hashable
179 */
180static void
181AddValue(PossibleValueSet *pvs, Const *valueToCopy)
182{
183 if (pvs->set == NULL)
184 {
185 Assert(pvs->memoryContext == NULL);
186
187 pvs->memoryContext = AllocSetContextCreate(CurrentMemoryContext,
188 "PossibleValueSet",
189 ALLOCSET_DEFAULT_MINSIZE,
190 ALLOCSET_DEFAULT_INITSIZE,
191 ALLOCSET_DEFAULT_MAXSIZE);
192 pvs->set = CreateNodeSetHashTable(pvs->memoryContext);
193 }
194
195 if (!ContainsValue(pvs, valueToCopy))
196 {
197 bool found; /* unused but needed in call */
198 MemoryContext oldContext = MemoryContextSwitchTo(pvs->memoryContext);
199
200 Const *key = copyObject(valueToCopy);
201 ConstHashValue *entry = hash_search(pvs->set, &key, HASH_ENTER, &found);
202
203 entry->c = key;
204
205 MemoryContextSwitchTo(oldContext);
206 }
207}
208
209static void
210SetToNoValuesPossible(PossibleValueSet *pvs)

Calls 4

CreateNodeSetHashTableFunction · 0.85
ContainsValueFunction · 0.85
MemoryContextSwitchToFunction · 0.85
hash_searchFunction · 0.85

Tested by

no test coverage detected