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

[INT64] Modulo operation returns incorrect result only in case of int64

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.5.0
    • Fix Version/s: Mad-Hatter
    • Component/s: query
    • Environment:
      Build: 5.5.0-2556

      Node 1: kv, index, n1ql
    • Triage:
      Untriaged
    • Is this a Regression?:
      Unknown

      Description

      Steps:

      1. Install and configure cluster. Create bucket b1
      2. Have following documents:

      d1 - {"long_num":-9223372036854775808}
      d2 - {"long_num":-9223372036854770000}
      d3 - {"long_num":10}
      d4 - {"long_num":-2147483600}

      3. Create index i1

      create index i1 on b1(long_num)

      4. Run Following query:

      SELECT long_num FROM b1 use index (i1) where (long_num % 10 == 0)

      Results obtained:

      [
      {
      "long_num": -2147483600
      },
      {
      "long_num": 10
      }
      ]

      Document d2 is also expected to be returned. 

      Logs: https://s3.amazonaws.com/bugdb/jira/abc/collectinfo-2018-04-24T133516-ns_1%40127.0.0.1.zip

       

       

       

       

        Attachments

          Issue Links

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

            Activity

            Hide
            prathibha Prathibha Bisarahalli added a comment -

            Explain plan indicates that full index scan is requested from n1ql:

            {
              "spans": [
                {
                  "range": [
                    {
                      "inclusion": 0,
                      "low": "null"
                    }
                  ]
                }
              ]
            }
            

            Verified that indexer returns all four results as below (logged the results returned by indexer):
            [-9223372036854775808]
            [-9223372036854770000]
            [-2147483600]
            [10]

            %10 is applied by n1ql as indicated in explain plan:
            "#operator": "Filter",
            "condition": "((cover ((`default`.`long_num`)) % 10) = 0)"

            Assigning to query team for investigation.

            Show
            prathibha Prathibha Bisarahalli added a comment - Explain plan indicates that full index scan is requested from n1ql: { "spans": [ { "range": [ { "inclusion": 0, "low": "null" } ] } ] } Verified that indexer returns all four results as below (logged the results returned by indexer): [-9223372036854775808] [-9223372036854770000] [-2147483600] [10] %10 is applied by n1ql as indicated in explain plan: "#operator": "Filter", "condition": "((cover ((`default`.`long_num`)) % 10) = 0)" Assigning to query team for investigation.
            Hide
            Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited

            When do % it uses number i.e. float64. values above or below 2**53 looses precision when converted to float64 (MB-24464). If you need Integer module Use
            SELECT long_num FROM default use index (i1) where (IMOD(long_num, 10) == 0);

            Show
            Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited When do % it uses number i.e. float64. values above or below 2**53 looses precision when converted to float64 ( MB-24464 ). If you need Integer module Use SELECT long_num FROM default use index (i1) where (IMOD(long_num, 10) == 0);
            Hide
            keshav Keshav Murthy added a comment -

            These are different symptoms of the issue reported by MB-24464.  See the comments there for the analysis and plan.

            Show
            keshav Keshav Murthy added a comment - These are different symptoms of the issue reported by  MB-24464 .  See the comments there for the analysis and plan.
            Hide
            keshav Keshav Murthy added a comment -

            Duplicate of MB-24464.

            Show
            keshav Keshav Murthy added a comment - Duplicate of  MB-24464 .
            Hide
            raju Raju Suravarjjala added a comment -

            Bulk closing invalid, duplicate and cannot reproduce bugs. Feel free to reopen

            Show
            raju Raju Suravarjjala added a comment - Bulk closing invalid, duplicate and cannot reproduce bugs. Feel free to reopen

              People

              • Assignee:
                keshav Keshav Murthy
                Reporter:
                prasanna.gholap Prasanna Gholap
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.