[SERVER-60239] $group with $and expression fails Created: 27/Sep/21  Updated: 29/Oct/23  Resolved: 28/Sep/21

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

Type: Bug Priority: Major - P3
Reporter: Eric Cox (Inactive) Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-60203 Translation of the groupBy expression... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Classic engine:

> db.t.insert({a: 1})
WriteResult({ "nInserted" : 1 })
> db.t.aggregate([{$group: {_id: {$and: ["$a", true]}, s: {$sum: "$b"}}}])
{ "_id" : true, "s" : 0 }

SBE and featureFlagGroupPushdown on,

> db.t.aggregate([{$group: {_id: {$and: ["$a", true]}, s: {$sum: "$b"}}}])

Hits MONGO_UNREACHABLE in:

{"t":{"$date":"2021-09-27T14:28:38.628+00:00"},"s":"F",  "c":"ASSERT",   "id":23079,   "ctx":"conn1","msg":"Invariant failure","attr":{"expr":"Hit a MONGO_UNREACHABLE!","file":"src/mongo/db/query/sbe_stage_builder_expression.cpp","line":957}}

Sprint: QE 2021-10-04
Participants:

 Description   

This is the same symptom as SERVER-60191.

https://logkeeper.mongodb.org/lobster/build/472a65d3c0dbccb417431733d620a7de/test/614f9d31f84ae83a60e3c0e2#bookmarks=0%2C19871&l=1&shareLine=19782



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Yoon Soo Kim [ 27/Sep/21 ]

eric.cox, yes and we need to update DocumentSourceGroup's _sbeCompatible again after pipeline optimization because $coerceToBool is added while we optimize a pipeline stage after parsing is done.

Comment by Eric Cox (Inactive) [ 27/Sep/21 ]

Should we consider setting expCtx->sbeCompatible in ExpressionCoerceToBool as we do with other Expressions?

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