You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Dmitry Lychagin (JIRA)" <ji...@apache.org> on 2018/08/28 21:38:00 UTC

[jira] [Created] (ASTERIXDB-2447) Incorrect handling of non-primitive arguments by if_missing, if_null functions

Dmitry Lychagin created ASTERIXDB-2447:
------------------------------------------

             Summary: Incorrect handling of non-primitive arguments by if_missing, if_null functions
                 Key: ASTERIXDB-2447
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2447
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
            Reporter: Dmitry Lychagin
            Assignee: Dmitry Lychagin


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 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)