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

Function ResultSet_AddRecord

src/resultset/resultset.c:131–157  ·  view source on GitHub ↗

add a new row to resultset

Source from the content-addressed store, hash-verified

129
130// add a new row to resultset
131int ResultSet_AddRecord
132(
133 ResultSet *set, // resultset to extend
134 Record r // record containing projected data
135) {
136 ASSERT(r != NULL);
137 ASSERT(set != NULL);
138
139 // copy projected values from record to resultset
140 for(int i = 0; i < set->column_count; i++) {
141 int idx = set->columns_record_map[i];
142 SIValue *cell = DataBlock_AllocateItem(set->cells, NULL);
143 *cell = Record_Get(r, idx);
144 SIValue_Persist(cell);
145 set->cells_allocation |= SI_ALLOCATION(cell);
146 }
147
148 // remove entry from record in a second pass
149 // this will ensure duplicated projections are not removed
150 // too early, consider: MATCH (a) RETURN max(a.val), max(a.val)
151 for(int i = 0; i < set->column_count; i++) {
152 int idx = set->columns_record_map[i];
153 Record_Remove(r, idx);
154 }
155
156 return RESULTSET_OK;
157}
158
159// update resultset index creation statistics
160void ResultSet_IndexCreated

Callers 1

ResultsConsumeFunction · 0.85

Calls 4

DataBlock_AllocateItemFunction · 0.85
Record_GetFunction · 0.85
SIValue_PersistFunction · 0.85
Record_RemoveFunction · 0.85

Tested by

no test coverage detected