MCPcopy Create free account
hub / github.com/documentdb/documentdb / MatchClauseWithIndexForFuncExpr

Function MatchClauseWithIndexForFuncExpr

pg_documentdb/src/index_am/rum.c:914–940  ·  view source on GitHub ↗

Given an operator expression and an index column with an index * Validates whether that operator + column is supported in this index */

Source from the content-addressed store, hash-verified

912/* Given an operator expression and an index column with an index
913 * Validates whether that operator + column is supported in this index */
914static bool
915MatchClauseWithIndexForFuncExpr(IndexPath *path, int32_t indexcol, Oid funcId, List *args)
916{
917 Node *operand = (Node *) lsecond(args);
918
919 /* not a const - can't evaluate this here */
920 if (!IsA(operand, Const))
921 {
922 return true;
923 }
924
925 /* if no options - thunk to default cost estimation */
926 bytea *options = path->indexinfo->opclassoptions[indexcol];
927 if (options == NULL)
928 {
929 return true;
930 }
931
932 BsonIndexStrategy strategy = GetBsonStrategyForFuncId(funcId);
933 if (strategy == BSON_INDEX_STRATEGY_INVALID)
934 {
935 return false;
936 }
937
938 Datum queryValue = ((Const *) operand)->constvalue;
939 return ValidateIndexForQualifierValue(options, queryValue, strategy);
940}
941
942
943/*

Callers 1

IsIndexIsValidForQueryFunction · 0.85

Calls 2

GetBsonStrategyForFuncIdFunction · 0.85

Tested by

no test coverage detected