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

Function GinBsonExtractQueryMod

pg_documentdb/src/opclass/bson_gin_core.c:2772–2801  ·  view source on GitHub ↗

* GinBsonExtractQueryMod generates the index term, needed to match * $mod on a dotted path, and value. * In this case, We return a lower bound value of the min value for that path. * Since we set the PartialMatch value to be true, the min value will be considered * a lower bound for the indexed search. * We also pass the $mod query value array of [Divisor, Remainder] as 'extraData' */

Source from the content-addressed store, hash-verified

2770 * We also pass the $mod query value array of [Divisor, Remainder] as 'extraData'
2771 */
2772static Datum *
2773GinBsonExtractQueryMod(BsonExtractQueryArgs *args)
2774{
2775 int32 *nentries = args->nentries;
2776 bool **partialmatch = args->partialmatch;
2777 Pointer **extra_data = args->extra_data;
2778
2779 Datum *entries;
2780 pgbsonelement documentElement;
2781 pgbsonelement filterElement = args->filterElement;
2782
2783 *extra_data = (Pointer *) palloc(sizeof(Pointer));
2784 **extra_data = (Pointer) PgbsonElementToPgbson(&filterElement);
2785
2786 /* find all values starting at mininum value. */
2787 documentElement.path = filterElement.path;
2788 documentElement.pathLength = filterElement.pathLength;
2789 documentElement.bsonValue.value_type = BSON_TYPE_DOUBLE;
2790 documentElement.bsonValue.value.v_double = (double) NAN;
2791
2792 *nentries = 1;
2793 entries = (Datum *) palloc(sizeof(Datum));
2794 *partialmatch = (bool *) palloc(sizeof(bool));
2795 **partialmatch = true;
2796 entries[0] = PointerGetDatum(SerializeBsonIndexTerm(&documentElement,
2797 &args->termMetadata).
2798 indexTermVal);
2799
2800 return entries;
2801}
2802
2803
2804/*

Callers 1

GinBsonExtractQueryCoreFunction · 0.85

Calls 2

PgbsonElementToPgbsonFunction · 0.85
SerializeBsonIndexTermFunction · 0.85

Tested by

no test coverage detected