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

Function ResultSet_MapProjection

src/resultset/resultset.c:99–117  ·  view source on GitHub ↗

map each column to a record index such that when resolving resultset row i column j we'll extract data from record at position columns_record_map[j]

Source from the content-addressed store, hash-verified

97// such that when resolving resultset row i column j we'll extract
98// data from record at position columns_record_map[j]
99void ResultSet_MapProjection
100(
101 ResultSet *set, // resultset to init mappings for
102 rax *mapping // mapping
103) {
104 ASSERT(set != NULL);
105 ASSERT(mapping != NULL);
106
107 if(set->columns_record_map == NULL) {
108 set->columns_record_map = rm_malloc(sizeof(uint) * set->column_count);
109 }
110
111 for(uint i = 0; i < set->column_count; i++) {
112 const char *column = set->columns[i];
113 void *idx = raxFind(mapping, (unsigned char *)column, strlen(column));
114 ASSERT(idx != raxNotFound);
115 set->columns_record_map[i] = (intptr_t)idx;
116 }
117}
118
119// returns number of rows in result-set
120uint64_t ResultSet_RowCount

Callers 4

JoinInitFunction · 0.85
JoinConsumeFunction · 0.85
JoinResetFunction · 0.85
ResultsInitFunction · 0.85

Calls 1

rm_mallocFunction · 0.85

Tested by

no test coverage detected