Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2447

Incorrect handling of non-primitive arguments by if_missing, if_null functions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • COMP - Compiler
    • 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 

       

      Attachments

        Activity

          People

            dlychagin-cb Dmitry Lychagin
            dlychagin-cb Dmitry Lychagin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: