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

Function QueryGraph_ResolveUnknownRelIDs

src/graph/query_graph.c:510–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510void QueryGraph_ResolveUnknownRelIDs
511(
512 QueryGraph *qg
513) {
514 // no unknown relationships - no need to updated
515 if(!qg->unknown_reltype_ids) return;
516
517 Schema *s = NULL;
518 bool unkown_relationships = false;
519 GraphContext *gc = QueryCtx_GetGraphCtx();
520 uint edge_count = QueryGraph_EdgeCount(qg);
521
522 // update edges
523 for(uint i = 0; i < edge_count; i++) {
524 QGEdge *edge = qg->edges[i];
525 uint rel_types_count = array_len(edge->reltypeIDs);
526 for(uint j = 0; j < rel_types_count; j++) {
527 if(edge->reltypeIDs[j] == GRAPH_UNKNOWN_RELATION) {
528 s = GraphContext_GetSchema(gc, edge->reltypes[j], SCHEMA_EDGE);
529 if(s) edge->reltypeIDs[j] = s->id;
530 else unkown_relationships = true; // cannot update the unkown relationship
531 }
532 }
533 }
534
535 qg->unknown_reltype_ids = unkown_relationships;
536}
537
538QueryGraph *QueryGraph_Clone
539(

Callers 1

_ClonePlanInternalsFunction · 0.85

Calls 4

QueryCtx_GetGraphCtxFunction · 0.85
QueryGraph_EdgeCountFunction · 0.85
array_lenFunction · 0.85
GraphContext_GetSchemaFunction · 0.85

Tested by

no test coverage detected