Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
if_missing, if_null functions return one of the arguments. When input values are of different non-primitive types then the output type is computed as 'any', but the argument is returned as is at runtime (without casting). This may cause problems for consumers of the returned values.
For example:
{ "j": ( let v = if_null( case when get_year(current_datetime()) > 0 then null else false end, \{ "c": [ 2 ] } )
select v as b
) }
currently returns
{ "j": [ { "b":
{ }} ] }
but it should return:
{ "j": [ { "b":
{ "c": [ 2 ] }} ] }
Parameters of these functions should be rewritten by the optimizer in the same manner as parameters of the switch-case function