Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.0.1, 7.1.0, 7.2.0
-
Security Level: Public
-
Official Couchbase Docker Image
-
Untriaged
-
1
-
Unknown
Description
We've encountered an issue with a query in Customer360 that isn't working correctly. We've reproduced the issue in a Docker container running Couchbase Server. With the documents attached (named in CB: JIRA::ID) and indexes listed below, we believe the query should be returning two documents. However, the query only returns one.
Query:
WITH capella_links AS (OBJECT result.link_id: result.issue_links FOR result IN (
|
SELECT SPLIT(j.remote_link, "/")[-1] AS link_id, |
ARRAY link FOR link IN TO_ARRAY(j.issue_links) WHEN link NOT LIKE "CCBSE-%" END AS issue_links |
FROM customer_dashboard j
|
WHERE j.type = "JIRA::CCBSE" |
AND j.remote_link IS NOT NULL) END)
|
SELECT ARRAY account_name FOR account_name IN ARRAY_DISTINCT(ARRAY_FLATTEN(ARRAY_AGG(j.account_name),1)) WHEN account_name IS NOT NULL END AS accounts |
FROM `customer_dashboard` j
|
JOIN `customer_dashboard` l ON KEYS ["JIRA::AV-10168"] |
WHERE j.type LIKE "JIRA::CBSE" |
AND l.id = "AV-10168" |
AND j.status = "Open" |
AND ARRAY_LENGTH(ARRAY_CONCAT(NVL(TO_ARRAY(j.issue_links), []), NVL(capella_links.[j.id], []))) > 0 |
AND j.issue_type = "Improvement" |
GROUP BY l,
|
j,
|
capella_links
|
ORDER BY COUNT(1) DESC, |
l.id ASC
|
It appears there is something weird going on with this particular statement:
AND ARRAY_LENGTH(ARRAY_CONCAT(NVL(TO_ARRAY(j.issue_links), []), NVL(capella_links.[j.id], []))) > 0 |
Indexes:
CREATE INDEX `cbse_closed_links` ON `customer_dashboard`(`id`,`issue_type`,`issue_links`,`summary`,`components`) WHERE ((`type` = "JIRA::CBSE") and (`status` = "Open")) |
CREATE INDEX `customer_page_issues_index` ON `customer_dashboard`(`id`,(distinct (array `a` for `a` in `account_name` end)),`issue_links`,`summary`,`status`,`account_name`,`components`,`fix_versions`,`created`,`updated`,`assignee`,`business_impact`) WHERE ((`type` = "JIRA::CBSE") and (`issue_type` = "Improvement")) |
Why is only one document returned from this query?