[SERVER-67774] Heuristic CE for FilterNode with a single comparison predicate Created: 05/Jul/22  Updated: 02/Aug/22  Resolved: 02/Aug/22

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

Type: Task Priority: Major - P3
Reporter: Timour Katchaounov Assignee: Henri Nikku
Resolution: Duplicate Votes: 0
Labels: M2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-67776 Heuristic CE for FilterNode with a Bo... Closed
Sprint: QO 2022-07-25, QO 2022-08-08
Participants:

 Description   

Estimate the cardinality of a FilterNode that represents a single comparison predicate such as

{a: 5}

, or {a: {$gt: 13}}.

This task should implement logic that walks the path expression of a FilterNode, extracts the components of a comparison operation, and calls the heuristic estimation function.

Below are a few examples of the structure of a FilterNode ABT:

Query: {a : 123}
 
Root []
|   |   projections: 
|   |       scan_0
|   RefBlock: 
|       Variable [scan_0]
Filter []
|   EvalFilter []
|   |   Variable [scan_0]
|   PathGet [a]
|   PathTraverse []
|   PathCompare [Eq]
|   Const [123]
Scan [test]
    BindBlock:
        [scan_0]
            Source []

The below example shows that open-ended comparisons are always completed with the lowest (in this case the empty string "") value, or the greatest value of the type. This is done to ensure correct type bracketing behavior.

Query: {a: {$gt:44}}
Initial ABT:
Root []
|   |   projections: 
|   |       scan_0
|   RefBlock: 
|       Variable [scan_0]
Filter []
|   EvalFilter []
|   |   Variable [scan_0]
|   PathGet [a]
|   PathTraverse []
|   PathComposeM []
|   |   PathCompare [Lt]
|   |   Const [""]
|   PathCompare [Gt]
|   Const [44]
Scan [test]
    BindBlock:
        [scan_0]
            Source []


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