Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.6.0, Morpheus, 7.6.2, 7.6.1, 7.6.4
-
Untriaged
-
0
-
Yes
Description
When the encoded plan of a statement containing path.* expressions in the projection, is unmarshalled and then executed - wrong results ( missing fields in result entries ) can be observed.
Repro:
1. Setup 2 node cluster with Query, Index, Data service.
2.
INSERT INTO default VALUES |
(
|
"key::1", { "type": "document", "id": 1 }), |
("key::2", { "type": "document", "id": 2 }), |
("key::3", { "type": "document", "name": "Raj", "timezone": "Local", "id": 3 } |
);
|
3.
prepare prep1 as select d.* from default as d ORDER BY id; |
4. Execute the prepared statement on both query nodes. On one query node the last document will have missing fields. This is incorrect.
[
|
{
|
"id": 1, |
"type": "document" |
},
|
{
|
"id": 2, |
"type": "document" |
},
|
{
|
"id": 3, |
"type": "document" |
}
|
]
|
Issue:
- During the Marshalling of the plan, the number of star expressions is not preserved. And hence, the information is lost when the
encoded plan is unmarshalled: https://github.com/couchbase/query/blob/master/plan/project.go#L101 - Hence, the projection order of each document is not re-evaluated for every projection item when there are star expressions in the
projection.: https://github.com/couchbase/query/blob/d5fe10d0e024b8815ed61681c3db7e5a94012c64/execution/project_initial.go#L343 - Hence, only the top-level fields present in the first item processed by the InitialProject operator, will be be preserved for every item. Which is incorrect.
- This leads to fields being missing in the results.
Attachments
Issue Links
- is caused by
-
MB-53938 SELECT-list order
- Closed