on 09-23-2009 6:04 PM
Hello,
we have a strange behavior if an input is null for standard functions and UDFs.
Requirement is to set a target field to "false" if an element does not exist. So what I do is to create an UDF and check whether the input is null :
if (input!= null)
{
return "true";
}
else
{
return "false";
}
So return should be either "false" or "true" in any case. However if the input is null i also get a null value as return. This is very similar to the behavior of standard functions such as "concat" because if one input value is null, then also the output string is null.
Is this expected behavior? It is not possible to use "mapWithDefault" as an empty string should return true, only if the element does not exist at all there should be a false returned.
Thank you for your advice.
Hi Florian,
Can you try like this:
if source field exists then true --> mapwithdefault(false) -->output.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.