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

Function AR_COALESCE

src/arithmetic/conditional_funcs/conditional_funcs.c:65–76  ·  view source on GitHub ↗

Coalesce - return the first value which is not null. Defaults to null.

Source from the content-addressed store, hash-verified

63
64// Coalesce - return the first value which is not null. Defaults to null.
65SIValue AR_COALESCE(SIValue *argv, int argc, void *private_data) {
66 for(int i = 0; i < argc; i++)
67 if(!SIValue_IsNull(argv[i])) {
68 /* Avoid double free, since the value is propagated and will be free twice:
69 * 1. Argument array free.
70 * 2. Record free. */
71 SIValue copy = argv[i];
72 SIValue_MakeVolatile(argv + i);
73 return copy;
74 }
75 return SI_NullVal();
76}
77
78// Distinct maintains a set of values,
79// if value `X` already in the set return NULL,

Callers

nothing calls this directly

Calls 3

SIValue_IsNullFunction · 0.85
SIValue_MakeVolatileFunction · 0.85
SI_NullValFunction · 0.85

Tested by

no test coverage detected