[SERVER-62376] Fix ABT translation for match expressions which compare against array values Created: 05/Jan/22  Updated: 28/Jun/22  Resolved: 25/Jan/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Hana Pearlman Assignee: Hana Pearlman
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: QO 2022-01-10, QO 2022-01-24, QO 2022-02-07
Participants:

 Description   

Current ABTs for $eq, $exists, $in, and $type can fail when matching against arrays.

For example {$match: {a: {$eq: ["abc"]}}} should match both {a: ["abc"]} and {a: [["abc"]]}, though it currently only matches the latter. This is because in the first case PathTraverse will perform comparisons on the array elements (that is, "abc") but not the top-level array. In SBE the solution seems to be to detect when a comparison against a top-level array is necessary, and specifically compare against it in addition to the comparison done by the traverse.

 I think it should be fixed during translation to ABT (as opposed to path lowering, or somewhere else), otherwise either 1) the ABTs produced by translation would be semantically incorrect until lowering or 2) the PathTraverse operator would have a different meaning within an ABT than "traverse" does in an SBE plan.



 Comments   
Comment by Hana Pearlman [ 25/Jan/22 ]

Closing in favor of SERVER-62961; see details there.

Generated at Thu Feb 08 05:54:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.