| 111 | } |
| 112 | |
| 113 | static XXH64_hash_t _ComputeGroupKey |
| 114 | ( |
| 115 | SIValue *keys, |
| 116 | OpAggregate *op, |
| 117 | Record r |
| 118 | ) { |
| 119 | // initialize the hash state |
| 120 | XXH64_state_t state; |
| 121 | XXH_errorcode res = XXH64_reset(&state, 0); |
| 122 | ASSERT(res != XXH_ERROR); |
| 123 | |
| 124 | for(uint i = 0; i < op->key_count; i++) { |
| 125 | AR_ExpNode *exp = op->key_exps[i]; |
| 126 | // note if AR_EXP_Evaluate throws a runtime exception we will leak |
| 127 | keys[i] = AR_EXP_Evaluate(exp, r); |
| 128 | // update the hash state with the current value. |
| 129 | SIValue_HashUpdate(keys[i], &state); |
| 130 | } |
| 131 | |
| 132 | // finalize the hash |
| 133 | return XXH64_digest(&state); |
| 134 | } |
| 135 | |
| 136 | // retrieves group under which given record belongs to |
| 137 | // creates group if it doesn't exists |
no test coverage detected