Hi,

I am not sure if I understand this. 
And I am not aware of such change.
I tried reproducing this with 2.8 and it seems that `null` values are not 
excluded from UDF results.
Here's what I tried:

var functions = require("org/arangodb/aql/functions");

/* register a simple UDF that returns null for any falsey value */
functions.register("foo::bar", function(a) { if (a) return a; return null; 
});

db._query("FOR i IN [-1, 0, null, 1, 2] RETURN foo::bar(i)").toArray()
[ 
  -1, 
  null, 
  null, 
  1, 
  2 
]

To me it looks like that null return values from a UDF are included in 
query results.
This doesn't change when I modify the UDF to return an array that includes 
null values:

functions.register("foo::bar", function(a) { if (a) return [1, a]; return 
[1, null]; });

db._query("FOR i IN [-1, 0, null, 1, 2] RETURN foo::bar(i)").toArray()
[ 
  [ 
    1, 
    -1 
  ], 
  [ 
    1, 
    null 
  ], 
  [ 
    1, 
    null 
  ], 
  [ 
    1, 
    1 
  ], 
  [ 
    1, 
    2 
  ] 
]

Still null values are included in the UDF result.
I tried the above with 2.8.11.

If the behavior is the same in later versions, then I think the behavior 
hasn't changed.

However, if you are referring to JavaScript `undefined` values: 
when a UDF returns `undefined`, any such value is converted to `null`, 
because `undefined` has no equivalent in JSON.
But I neither think this behavior has changed between 2.8 and 3.x.

Can you supply an example query (and the UDF) that changed their behavior?
Thanks
Jan


Am Montag, 13. März 2017 08:48:13 UTC+1 schrieb Georgios Kafataridis:
>
> I noticed in arangodb 3  that when a UDF returns null as a result it is 
> included in the resulting dataset. 
> That created problems in parts of my code where I had pagination, because 
> the results where void of any actual data but still included.
>
> In arango 2.8 null returns where excluded/ignored completely with no need 
> to handle them in the query.
>
> I managed to resolve it easily by adding a filter excluding the null 
> results but I wanted to ask though what drove you to this change. Is there 
> any reference in the change log ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to