MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _list2dict

Function _list2dict

src/arithmetic/list_funcs/list_funcs.c:560–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558}
559
560static dict *_list2dict
561(
562 SIValue list
563) {
564 uint32_t n = SIArray_Length(list);
565 dict *values = HashTableCreate(&def_dt);
566 for(uint i = 0; i < n; i++) {
567 SIValue val = SIArray_Get(list, i);
568 XXH64_state_t state;
569 XXH_errorcode res = XXH64_reset(&state, 0);
570 ASSERT(res != XXH_ERROR);
571
572 SIValue_HashUpdate(val, &state);
573
574 // finalize the hash
575 XXH64_hash_t hash = XXH64_digest(&state);
576 dictEntry *existing;
577 dictEntry *entry = HashTableAddRaw(values, (void *)hash, &existing);
578 }
579
580 return values;
581}
582
583// concatenate lists starting at specified position
584// list.insertListElements(list, list2, idx, dups = TRUE) -> list

Callers 1

AR_INSERTLISTELEMENTSFunction · 0.85

Calls 5

SIArray_LengthFunction · 0.85
HashTableCreateFunction · 0.85
SIArray_GetFunction · 0.85
SIValue_HashUpdateFunction · 0.85
HashTableAddRawFunction · 0.85

Tested by

no test coverage detected