Details
-
Bug
-
Resolution: Fixed
-
Critical
-
6.6.2, 7.1.0
-
Untriaged
-
1
-
Unknown
Description
Repro:
insert into default (key,value) values("e::g::1",{"type":"SUPPORTAL::snapshot","nodes":[{"results":{"checker_list":["Data Quota"]}},{"results":{"checker_list":["Data Quota"]}}]}); |
|
insert into default (key,value) values("e::g::2",{"type":"SUPPORTAL::snapshot","nodes":[{"results":{"checker_list":["Data Quota"]}},{"results":{"checker_list":["Data Quota"]}}]}); |
|
insert into default (key,value) values("e::g::3::0",{"type":"SUPPORTAL::snapshot","nodes":[{"results":{"checker_list":["Data Quota"]}},{"results":{"checker_list":["Data Quota"]}}]}); |
|
CREATE INDEX TESTING_INDEX ON `default`(`type`) WHERE ((`type` = 'SUPPORTAL::snapshot') and (array_intersect(array_flatten((array_star((array_star(`nodes`).`results`)).`checker_list`), 1), ['Data Quota', 'FTS Quota', 'Index Quota', 'Analytics Quota', 'Eventing Quota']) = ['Data Quota'])); |
The following two queries should produce the same results:
SELECT RAW SPLIT(META().id, "::")[2] FROM default WHERE type = "SUPPORTAL::snapshot" AND ARRAY_INTERSECT(ARRAY_FLATTEN(nodes[*].results[*].checker_list, 1), ["Data Quota", "FTS Quota", "Index Quota", "Analytics Quota", "Eventing Quota"]) = ["Data Quota"] GROUP BY SPLIT(META().id, "::")[2]; |
|
SELECT SPLIT(META().id, "::")[2] FROM default WHERE type = "SUPPORTAL::snapshot" AND ARRAY_INTERSECT(ARRAY_FLATTEN(nodes[*].results[*].checker_list, 1), ["Data Quota", "FTS Quota", "Index Quota", "Analytics Quota", "Eventing Quota"]) = ["Data Quota"] and SPLIT(META().id, "::")[2] is not null GROUP BY SPLIT(META().id, "::")[2]; |
as the only difference is the "SPLIT(META().id, "::")[2] is not null" clause and since SPLIT(META().id, "::")[2] is not null (see data) it should make no difference.
The first returns only one result instead of the 3 it should.
Of course in the plan, the first shows:
"index": "TESTING_INDEX", |
"index_group_aggs": { |
"depends": [ |
1 |
],
|
"group": [ |
{
|
"depends": [ |
1 |
],
|
"expr": "(split(cover ((meta(`default`).`id`)), \"::\")[2])", |
"id": 2, |
"keypos": -1 |
}
|
],
|
"partial": true |
},
|
whereas the latter doesn't (and processes it as a filter).
So it appears the results from the index group aggregate are truncated.