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

Function AR_SIZE

src/arithmetic/list_funcs/list_funcs.c:376–390  ·  view source on GitHub ↗

Return a list/string/map/path size. "RETURN size([1, 2, 3])" will return 3 TODO: when map and path are implemented, add their functionality */

Source from the content-addressed store, hash-verified

374 "RETURN size([1, 2, 3])" will return 3
375 TODO: when map and path are implemented, add their functionality */
376SIValue AR_SIZE(SIValue *argv, int argc, void *private_data) {
377 ASSERT(argc == 1);
378 SIValue value = argv[0];
379 switch(SI_TYPE(value)) {
380 case T_ARRAY:
381 return SI_LongVal(SIArray_Length(value));
382 case T_STRING:
383 return SI_LongVal(str_length(value.stringval));
384 case T_NULL:
385 return SI_NullVal();
386 default:
387 ASSERT(false);
388 return SI_NullVal();
389 }
390}
391
392/* Return the first member of a list.
393 "RETURN head([1, 2, 3])" will return 1 */

Callers

nothing calls this directly

Calls 4

SI_LongValFunction · 0.85
SIArray_LengthFunction · 0.85
str_lengthFunction · 0.85
SI_NullValFunction · 0.85

Tested by

no test coverage detected