Details

    • Technical task
    • Resolution: Won't Fix
    • Major
    • Neo.Next
    • Cheshire-Cat, 6.x Doc Updates, Neo
    • query
    • 1

    Description

      Few examples :

      SELECT IFINF(2.001e340,2);

       

      SELECT IFNAN(sqrt(-1),2);

       

      https://golang.org/pkg/math/

       

      If val > MaxFolat64 is +Infinity

      If val < -MaxFolat64 -Infinity

      MaxFloat64 = 1.797693134862315708145274237317043567981e+308 // 2*1023 * (253 - 1) / 2*52

       

       

       

      From: Keshav Murthy <keshav@couchbase.com>
      Date: Wednesday, March 21, 2018 at 9:31 AM
      To: Guy Klages <guy.klages@couchbase.com>
      Cc: Sitaram Vemulapalli <Sitaram.Vemulapalli@couchbase.com>
      Subject: FW: Need more details for IFINF, IFNAN etc

       

      can you please ensure these are documented well. Thank you.

       

      Cheers, Keshav | 510.676.0824 | Blog | @rkeshavmurthy

       

      From: Sitaram Vemulapalli <Sitaram.Vemulapalli@couchbase.com>
      Date: Wednesday, March 21, 2018 at 6:00 AM
      To: Ritesh Agarwal <Ritesh.Agarwal@couchbase.com>, Dmitry Lychagin <dmitry.lychagin@couchbase.com>, Keshav Murthy <keshav@couchbase.com>
      Cc: Till Westmann <Till@couchbase.com>, Mihir Kamdar <Mihir.Kamdar@couchbase.com>, Ritam Sharma <ritam@couchbase.com>
      Subject: Re: Need more details for IFINF, IFNAN etc

       

      Select 1/0;

      Evaluates to NULL. In my opinion it is right because NULL means undefined an Infinity also undefined.

       

       IFINF, IFNAN both working as expected.

       

      You should use INF() generate Infinity. The functions listed here https://github.com/couchbase/query/blob/master/expression/func_registry.go#L204

       

       

       select IFINF(inf(),2);

      {

          "requestID": "69526c8b-6e34-428c-ba68-6477ffbccc33",

          "signature": {

              "$1": "number"

          },

          "results": [

              {

                  "$1": 2

              }

          ],

          "status": "success",

          "metrics": {

              "elapsedTime": "648.393µs",

              "executionTime": "613.33µs",

              "resultCount": 1,

              "resultSize": 31

          }

      }

      From: Ritesh Agarwal <Ritesh.Agarwal@couchbase.com>
      Date: Tuesday, March 20, 2018 at 11:28 PM
      To: Dmitry Lychagin <dmitry.lychagin@couchbase.com>, Keshav Murthy <keshav@couchbase.com>, Sitaram Vemulapalli <Sitaram.Vemulapalli@couchbase.com>
      Cc: Till Westmann <Till@couchbase.com>, Mihir Kamdar <Mihir.Kamdar@couchbase.com>, Ritam Sharma <ritam@couchbase.com>
      Subject: Re: Need more details for IFINF, IFNAN etc

       

      + Sitaram

       

      From: Ritesh Agarwal <Ritesh.Agarwal@couchbase.com>
      Date: Monday, March 19, 2018 at 1:43 PM
      To: Dmitry Lychagin <dmitry.lychagin@couchbase.com>, Keshav Murthy <keshav@couchbase.com>
      Cc: Till Westmann <Till@couchbase.com>, Mihir Kamdar <Mihir.Kamdar@couchbase.com>, Ritam Sharma <ritam@couchbase.com>
      Subject: Need more details for IFINF, IFNAN etc

       

      Hi Keshav/Dmitry,

       

      In N1QL, according to the definition for IFINF:

      “Returns first non-MISSING, non-Inf number. Returns MISSING or NULL if a non-number input is encountered first.”

       

      For Query: select IFINF(1/0,2), where the first expression is infinite and second is a valid number, the result for N1QL is:

       

      [

        {

          "$1": null

        }

      ]

       

      which is incorrect according to the definition which says this function will return first non-inf number which is 2 in this case.

       

      Null result should come when first number encountered is non-number which let’s say a character or string. For eg: IFINF(‘a’,2) or IFINF(‘asd’,2).

       

      This question is for all the functions mentioned here: https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/condfunnum.html

       

      Can you please help me understand the expected behavior?

       

      Thanks,

      Ritesh

      Attachments

        Activity

          People

            Francis.roberts Francis Roberts
            guy.klages Guy Klages (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty