prepare all creations associated with the current Record returns false and do not buffer data if every entity to create for this Record has been created in a previous call
| 115 | // returns false and do not buffer data if every entity to create for this Record |
| 116 | // has been created in a previous call |
| 117 | static bool _CreateEntities(OpMergeCreate *op, Record r, GraphContext *gc) { |
| 118 | XXH_errorcode res = XXH64_reset(op->hash_state, 0); // reset hash state |
| 119 | UNUSED(res); |
| 120 | ASSERT(res != XXH_ERROR); |
| 121 | |
| 122 | //-------------------------------------------------------------------------- |
| 123 | // hash nodes |
| 124 | //-------------------------------------------------------------------------- |
| 125 | |
| 126 | uint nodes_to_create_count = array_len(op->pending.nodes_to_create); |
| 127 | |
| 128 | for(uint i = 0; i < nodes_to_create_count; i++) { |
| 129 | // get specified node to create |
| 130 | NodeCreateCtx *n = op->pending.nodes_to_create + i; |
| 131 | |
| 132 | // convert properties |
| 133 | PropertyMap *map = n->properties; |
| 134 | AttributeSet converted_attr = NULL; |
| 135 | if(map != NULL) { |
| 136 | ConvertPropertyMap(gc, &converted_attr, r, map, true); |
| 137 | } |
| 138 | |
| 139 | // update the hash code with this entity |
| 140 | uint label_count = array_len(n->labels); |
| 141 | _IncrementalHashEntity(op->hash_state, n->labels, label_count, |
| 142 | &converted_attr); |
| 143 | |
| 144 | // save attributes |
| 145 | array_append(op->pending.node_attributes, converted_attr); |
| 146 | |
| 147 | // save labels |
| 148 | array_append(op->pending.node_labels, n->labelsId); |
| 149 | } |
| 150 | |
| 151 | |
| 152 | //-------------------------------------------------------------------------- |
| 153 | // hash edges |
| 154 | //-------------------------------------------------------------------------- |
| 155 | |
| 156 | uint edges_to_create_count = array_len(op->pending.edges_to_create); |
| 157 | |
| 158 | for(uint i = 0; i < edges_to_create_count; i++) { |
| 159 | // get specified edge to create |
| 160 | EdgeCreateCtx *e = op->pending.edges_to_create + i; |
| 161 | |
| 162 | // retrieve source and dest nodes |
| 163 | Node *src_node = Record_GetNode(r, e->src_idx); |
| 164 | Node *dest_node = Record_GetNode(r, e->dest_idx); |
| 165 | |
| 166 | // convert query-level properties |
| 167 | PropertyMap *map = e->properties; |
| 168 | AttributeSet converted_attr = NULL; |
| 169 | if(map != NULL) { |
| 170 | ConvertPropertyMap(gc, &converted_attr, r, map, true); |
| 171 | } |
| 172 | |
| 173 | // update the hash code with this entity, an edge is represented by its |
| 174 | // relation, properties, source and destination nodes. |
no test coverage detected