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

Function BsonHashCompare

pg_documentdb_core/src/query/bson_hash.c:476–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474
475
476static uint64
477BsonHashCompare(bson_iter_t *bsonIterValue,
478 uint64 (*hash_bytes_func)(const uint8_t *bytes, uint32_t bytesLength,
479 int64 seed),
480 uint64 (*hash_combine_func)(uint64 left, uint64 right),
481 int64 seed,
482 const char *collationString)
483{
484 check_stack_depth();
485 uint64_t hashValue = 0;
486 while (bson_iter_next(bsonIterValue))
487 {
488 pgbsonelement leftElement;
489
490 BsonIterToPgbsonElement(bsonIterValue, &leftElement);
491
492 /* next compare field name. */
493 uint64_t pathHash = hash_bytes_func((uint8_t *) leftElement.path,
494 leftElement.pathLength, seed);
495 hashValue = hash_combine_func(hashValue, pathHash);
496
497 uint64_t valueHash = HashBsonValueCompare(&leftElement.bsonValue, hash_bytes_func,
498 hash_combine_func, seed,
499 collationString);
500 hashValue = hash_combine_func(hashValue, valueHash);
501 }
502
503 return hashValue;
504}
505
506
507/*

Callers 5

extension_bson_hash_int4Function · 0.85
extension_bson_hash_int8Function · 0.85
HashBsonComparableFunction · 0.85
HashBsonValueCompareFunction · 0.85

Calls 2

BsonIterToPgbsonElementFunction · 0.85
HashBsonValueCompareFunction · 0.85

Tested by

no test coverage detected