Details
-
Bug
-
Resolution: Fixed
-
Critical
-
4.5.1, 5.0.0
-
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
For Gerrit Dashboard: MB-20591 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
66911,1 | MB-20591: Encode nil when array is empty in array index | unstable | indexing | Status: ABANDONED | 0 | 0 |
67120,2 | MB-20591: Handle empty array in array indexing | unstable | indexing | Status: MERGED | +2 | +1 |
67152,2 | MB-100: Bring in bugfix for MB-20591 | master | manifest | Status: MERGED | +2 | +1 |