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

Function GinBsonExtractQueryEqual

pg_documentdb/src/opclass/bson_gin_core.c:1883–1907  ·  view source on GitHub ↗

* GinBsonExtractQueryEqual generates the index term needed to match * equality on a dotted path and value. * In this case, we can simply return the term as the value stored * in the index will be exactly the value being queried. * The query is expected to be of the format {path}{typeCode}{value} * i.e. a BsonElement. */

Source from the content-addressed store, hash-verified

1881 * i.e. a BsonElement.
1882 */
1883static Datum *
1884GinBsonExtractQueryEqual(BsonExtractQueryArgs *args)
1885{
1886 int32 *nentries = args->nentries;
1887 bool **partialmatch = args->partialmatch;
1888 Datum *entries;
1889 pgbsonelement filterElement = args->filterElement;
1890
1891 if (filterElement.bsonValue.value_type == BSON_TYPE_NULL)
1892 {
1893 /* special case for $eq on null. */
1894 entries = GenerateNullEqualityIndexTerms(nentries, partialmatch,
1895 &filterElement, &args->termMetadata);
1896 }
1897 else
1898 {
1899 *nentries = 1;
1900 entries = (Datum *) palloc(sizeof(Datum));
1901 entries[0] = PointerGetDatum(SerializeBsonIndexTerm(&filterElement,
1902 &args->termMetadata).
1903 indexTermVal);
1904 }
1905
1906 return entries;
1907}
1908
1909
1910/*

Callers 1

GinBsonExtractQueryCoreFunction · 0.85

Calls 2

SerializeBsonIndexTermFunction · 0.85

Tested by

no test coverage detected