[SERVER-66846] Translate $project by walking over ProjectionAST Created: 27/May/22  Updated: 29/Oct/23  Resolved: 20/Sep/22

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

Type: Task Priority: Major - P3
Reporter: Hana Pearlman Assignee: Hana Pearlman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2022-07-25, QO 2022-08-08, QO 2022-08-22, QO 2022-09-05, QO 2022-09-19, QO 2022-10-03
Participants:

 Description   

This would replace the current approach, which examines the projection_executor instead. This seems like it will require modifying DocumentSourceSingleDocTransform to store the original AST instead of throwing it away e.g. here.



 Comments   
Comment by Githook User [ 18/Nov/22 ]

Author:

{'name': 'Ben Shteinfeld', 'email': 'ben.shteinfeld@mongodb.com', 'username': 'bshteinfeld'}

Message: SERVER-68516 Revert back to always using `ProjectionExecutor` to translate projections to ABT

In SERVER-66846, we started using `ProjectionAST` as the input to ABT translations for inclusion/exclusion projections. SERVER-68516 was originally intended to update `$addFields` and `$replaceRoot` projections to also use the `ProjectionAST` codepath. However, we realized that `ProjectionAST` is not capable of representing these projections. So rather than losing functionality or maintaining two translation codepaths, we revert back to using `ProjectionExecutor` for translation.

Note this patch is not a clean revert of SERVER-66846. The diffs are:

  • Keeping the tests which the original commit introduced
  • Adding additional fallback logic for agg expressions and ensuring that the `_rootReplacementExpression` of a `ProjectionExecutor` is checked during the fallback mechanism. This was discovered because of a new test-case, added after SERVER-66846, for falling back to classic when a find query has a positional projection.
  • Updated comments
    Branch: master
    https://github.com/mongodb/mongo/commit/35c1d35f4870510bc0923e3db49eb026dcf93f32
Comment by Githook User [ 20/Sep/22 ]

Author:

{'name': 'Hana Pearlman', 'email': 'hana.pearlman@mongodb.com', 'username': 'HanaPearlman'}

Message: SERVER-66846 Translate simple inclusion and exclusion $project by walking over ProjectionAST

Co-authored-by: Emily Wang emily.wang@mongodb.com
Branch: master
https://github.com/mongodb/mongo/commit/9f8cd4b9e0099770650b8bbd7e18203cd73033a1

Generated at Thu Feb 08 06:06:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.