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

Function DeterminePossibleValueSet

src/backend/optimizer/util/predtest.c:2323–2355  ·  view source on GitHub ↗

* * Get the possible values of variable, as determined by the given qualification clause * * Note that only variables whose type is greenplumDbHashtable will return an actual finite set of values. All others * will go to the default behavior -- return that any value is possible * * Note that if there are two variables to check, you must call this twice. This then means that * if the

Source from the content-addressed store, hash-verified

2321 * possible values is within the cross-product of the two variables' sets
2322 */
2323PossibleValueSet
2324DeterminePossibleValueSet(Node *clause, Node *variable, Oid opfamily)
2325{
2326 PredIterInfoData clauseInfo;
2327 PossibleValueSet result;
2328
2329 if ( clause == NULL )
2330 {
2331 InitPossibleValueSetData(&result);
2332 return result;
2333 }
2334
2335 switch (predicate_classify(clause, &clauseInfo))
2336 {
2337 case CLASS_AND:
2338 return ProcessAndClauseForPossibleValues(&clauseInfo, clause, variable, opfamily);
2339 case CLASS_OR:
2340 return ProcessOrClauseForPossibleValues(&clauseInfo, clause, variable, opfamily);
2341 case CLASS_ATOM:
2342 if (TryProcessExprForPossibleValues(clause, variable, opfamily, &result))
2343 {
2344 return result;
2345 }
2346 /* can't infer anything, so return that any value is possible */
2347 InitPossibleValueSetData(&result);
2348 return result;
2349 }
2350
2351
2352 /* can't get here */
2353 elog(ERROR, "predicate_classify returned a bad value");
2354 return result;
2355}

Tested by

no test coverage detected