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

Function AR_EXP_IsAttribute

src/arithmetic/arithmetic_expression.c:67–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67bool AR_EXP_IsAttribute(const AR_ExpNode *exp, char **attr) {
68 ASSERT(exp != NULL);
69
70 // an arithmetic expression performs attribute extraction
71 // if it applys the "property" function, in which case the left-handside
72 // child represents the graph entity from which we access the attribute
73 // while the right-handside represents the attribute name
74
75 if(exp->type != AR_EXP_OP) return false;
76 if(strcmp(AR_EXP_GetFuncName(exp), "property") != 0) return false;
77
78 if(attr != NULL) {
79 AR_ExpNode *r = exp->op.children[1];
80 ASSERT(AR_EXP_IsConstant(r));
81 SIValue v = r->operand.constant;
82 ASSERT(SI_TYPE(v) == T_STRING);
83 *attr = v.stringval;
84 }
85
86 return true;
87}
88
89bool AR_EXP_PerformsDistinct(AR_ExpNode *exp) {
90 return AR_EXP_ContainsFunc(exp, "distinct");

Callers 6

_FilterTreeToInQueryNodeFunction · 0.85
_predicateTreeToRangeFunction · 0.85
_FilterTreeToQueryNodeFunction · 0.85
extractOriginAndRadiusFunction · 0.85
_applicable_predicateFunction · 0.85

Calls 2

AR_EXP_GetFuncNameFunction · 0.85
AR_EXP_IsConstantFunction · 0.85

Tested by

no test coverage detected