[SERVER-86208] Generation of $expr doesn't use type information Created: 05/Feb/24  Updated: 06/Feb/24

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

Type: Task Priority: Major - P3
Reporter: Alberto Massari Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

We currently support dateDiff() only because the time field has a declared type that allows the removal of the extra checks on the input type.
Writing the query

[{$match:  {
                "$expr": {
                    "$gt": [
                        {
                            "$dateDiff": {
                                "startDate": "$time",
                                "endDate": new Date(datePrefix + 150),
                                "unit": "millisecond"
                            }
                        },
                        0
                    ]
                }
            }
}]

generates a plan using the non-optimized tree that includes a few calls to typeMatch() that, being not yet supported, don't allow the vectorized execution of dateDiff().

Probably this is caused by not forwarding the type information into the conversion from ABT to EExpr


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