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

[Index API2] Distinct=true gives wrong results when projection is passed as nil

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.0.0
    • 5.0.0
    • query, secondary-index
    • None
    • Untriaged
    • Unknown

    Description

      When projection is nil means project the all the index keys and meta().id
      distinct= true means send distinct values of projection (i.e. when projection is nil the distinct needs to applied on all keys + meta().id).
      Distinct is hint to index API2. When passed it can ignore and provide duplicates. But it can't wrongly eliminate values.

      INSERT INTO default VALUES("k11",{"ka0":[5, 15], "k0":1});
      INSERT INTO default VALUES("k12",{"ka0":[5, 25], "k0":1});
      INSERT INTO default VALUES("k13",{"ka0":[4, 15], "k0":2});
      INSERT INTO default VALUES("k14",{"ka0":[4, 15], "k0":2});
      CREATE INDEX ix1 ON default (k0);
      SELECT DISTINCT meta().id, k0 FROM default WHERE k0 = 1;
      

      curl -H "Accept: application/json" -v Administrator:password@127.0.0.1:9102/api/index/17910814830959724252?multiscan=true -X GET -d '{"reverse": false, "projection": null, "distinct": true, "limit": 10000, "offset": 0, "stale": "false", "scans": "[{\"Filter\": [

      {\"Low\": 1, \"High\": 1, \"Inclusion\": 3}

      ]}]"}'

      Attachments

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

        Activity

          People

            Sitaram.Vemulapalli Sitaram Vemulapalli
            Sitaram.Vemulapalli Sitaram Vemulapalli
            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