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

Function SortReset

src/execution_plan/ops/op_sort.c:178–202  ·  view source on GitHub ↗

restart iterator

Source from the content-addressed store, hash-verified

176
177// restart iterator
178static OpResult SortReset(OpBase *ctx) {
179 OpSort *op = (OpSort *)ctx;
180 uint recordCount;
181
182 if(op->heap) {
183 recordCount = Heap_count(op->heap);
184 for(uint i = 0; i < recordCount; i++) {
185 Record r = (Record)Heap_poll(op->heap);
186 OpBase_DeleteRecord(r);
187 }
188 }
189
190 if(op->buffer) {
191 recordCount = array_len(op->buffer);
192 for(uint i = op->record_idx; i < recordCount; i++) {
193 Record r = op->buffer[i];
194 OpBase_DeleteRecord(r);
195 }
196 array_clear(op->buffer);
197 }
198
199 op->record_idx = 0;
200
201 return OP_OK;
202}
203
204static OpBase *SortClone(const ExecutionPlan *plan, const OpBase *opBase) {
205 ASSERT(opBase->type == OPType_SORT);

Callers

nothing calls this directly

Calls 4

Heap_countFunction · 0.85
Heap_pollFunction · 0.85
OpBase_DeleteRecordFunction · 0.85
array_lenFunction · 0.85

Tested by

no test coverage detected