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

Function QGNode_GetLabelID

src/graph/entities/qg_node.c:76–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76int QGNode_GetLabelID
77(
78 const QGNode *n,
79 uint idx
80) {
81 ASSERT(n != NULL);
82 ASSERT(idx < QGNode_LabelCount(n));
83
84 int labelId = n->labelsID[idx];
85
86 // in-case labelId is unknown at time it was created
87 // check if we can resolve it now
88 if(labelId == GRAPH_UNKNOWN_LABEL) {
89 GraphContext *gc = QueryCtx_GetGraphCtx();
90 ASSERT(gc != NULL);
91
92 // get schema by name
93 Schema *s = GraphContext_GetSchema(gc, n->labels[idx], SCHEMA_NODE);
94 if(s != NULL) {
95 labelId = Schema_GetID(s);
96 n->labelsID[idx] = labelId;
97 }
98 }
99
100 return labelId;
101}
102
103const char *QGNode_GetLabel
104(

Callers 3

reduce_scan_opFunction · 0.85
_optimizeLabelScanFunction · 0.85

Calls 4

QGNode_LabelCountFunction · 0.85
QueryCtx_GetGraphCtxFunction · 0.85
GraphContext_GetSchemaFunction · 0.85
Schema_GetIDFunction · 0.85

Tested by

no test coverage detected