Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-28960

IFNAN should return null if first expression is missing and second expression is null. Missing expression case in not handled.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.5.0
    • 6.5.0
    • analytics

    • Enterprise Edition 5.5.0 build 2325
    • Untriaged
    • No
    • CX Sprint 114, CX Sprint 115, CX Sprint 116, CX Sprint 117, CX Sprint 118, CX Sprint 119, CX Sprint 120, CX Sprint 121

    Description

      document:

      {
        "key": "val",
        "arr": [
          1,
          2
        ]
      }
      

      query:

      IFNAN(arr[2],arr[1])
      


      output:

      CBAS:
      [
        {}
      ]
      

      N1QL:
      [
        {
          "$1": 2
        }
      ]
      

      Missing field case is not handled.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            What is 'points'?

            dmitry.lychagin Dmitry Lychagin (Inactive) added a comment - What is 'points'?

            It seems that IFNAN() treats 'missing' as 'not-a-number' and therefore returns the second argument.

            Let's add this issue to the language alignment discussion. In general we return 'missing' if any argument is 'missing', for example for IFINF() function.

            Here's a query that demonstrates current n1ql behavior:

            select ifinf(missing, 1) as res_ifinf, ifnan(missing, 1) as res_ifnan
             
            {
             "results": [
             {
             "res_ifnan": 1
             }
             ]
            }
            

             

            dmitry.lychagin Dmitry Lychagin (Inactive) added a comment - - edited It seems that IFNAN() treats 'missing' as 'not-a-number' and therefore returns the second argument. Let's add this issue to the language alignment discussion. In general we return 'missing' if any argument is 'missing', for example for IFINF() function. Here's a query that demonstrates current n1ql behavior: select ifinf(missing, 1) as res_ifinf, ifnan(missing, 1) as res_ifnan   { "results": [ { "res_ifnan": 1 } ] }  

            Re-triage issues for the next release.

            till Till Westmann added a comment - Re-triage issues for the next release.

            Missing cases are fixed starting from Mad-Hatter build 1378.

            ali.alsuliman Ali Alsuliman added a comment - Missing cases are fixed starting from Mad-Hatter build 1378.

            Verified on build 6.5.0-3628

            ritesh.agarwal Ritesh Agarwal added a comment - Verified on build 6.5.0-3628

            People

              tanzeem.ahmed Tanzeem Ahmed (Inactive)
              ritesh.agarwal Ritesh Agarwal
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty