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

Function ae_labels_src

src/execution_plan/ops/shared/print_functions.c:20–52  ·  view source on GitHub ↗

return the labels of the src of ae splitted by ':'

Source from the content-addressed store, hash-verified

18
19// return the labels of the src of ae splitted by ':'
20static char* ae_labels_src
21(
22 AlgebraicExpression **ae // AlgebraicExpression to extract labels from
23) {
24 sds labels = sdsempty();
25 AlgebraicExpression *operand =
26 (AlgebraicExpression *) AlgebraicExpression_SrcOperand(*ae);
27
28 // as long as:
29 // 1. algebraic expression isn't empty
30 // 2. current operand is diagonal
31 while(*ae &&
32 operand->type == AL_OPERAND &&
33 operand->operand.diagonal) {
34
35 // remove source from expression
36 operand = AlgebraicExpression_RemoveSource(ae);
37
38 // update labels string
39 labels = sdscatprintf(labels, ":%s", operand->operand.label);
40
41 // free operand
42 AlgebraicExpression_Free(operand);
43
44 // advance to next source operand
45 if(*ae != NULL) {
46 operand =
47 (AlgebraicExpression *) AlgebraicExpression_SrcOperand(*ae);
48 }
49 }
50
51 return labels;
52}
53
54// return the labels of the dest of ae splitted by ':'
55static char* ae_labels_dest

Callers 1

TraversalToStringFunction · 0.85

Calls 5

sdsemptyFunction · 0.85
sdscatprintfFunction · 0.85
AlgebraicExpression_FreeFunction · 0.85

Tested by

no test coverage detected