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

indexer returns key values after array expression shifted to left if indexed on empty array

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 4.5.1
    • 4.5.1, 5.0.0
    • secondary-index
    • None
    • Untriaged
    • Unknown

    Description

      https://forums.couchbase.com/t/n1ql-array-indexing-empty-arrays-and-querying-meta-id/9491/5

      insert into default values ("101", { "docType": "Test", "tags": [], "title": "doc101" });
      insert into default values ("102", { "docType": "Test", "tags": [ "tag1" ], "title": "doc102" });
      insert into default values ("103", { "docType": "Test", "tags": [ "tag1", "tag2" ], "title": "doc103" });
      insert into default values ("104", { "docType": "Test", "tags": null, "title": "doc104" });
      CREATE INDEX ix02 ON `default`(docType, tags, DISTINCT ARRAY t FOR t IN tags END, title) WHERE docType="Test";
      SELECT META().id,title from default WHERE docType="Test”;
      --For key 101 title is missing
      

      Indexer returns the following values. As you see key 101 has only 3 elements and index has 4 keys. 3rd key is missing and we interpret 4th as 3rd.
      Are we need to return null of array expression if there are no elements?

      [Test [] doc101] ... 101
      [Test [tag1] tag1 doc102] ... 102
      [Test [tag1 tag2] tag1 doc103] ... 103
      [Test [tag1 tag2] tag1 doc103] … 103
      [Test null null doc104] ... 104

      Attachments

        Issue Links

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

          Activity

            People

              prathibha Prathibha Bisarahalli (Inactive)
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty