[SERVER-84713] Ensure the child of a SargableNode is always a ScanNode after substitution phase Created: 09/Jan/24  Updated: 18/Jan/24

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

Type: Improvement Priority: Major - P3
Reporter: Chi-I Huang Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-81589 [CQF] Avoid optimizer round-trip for ... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

Currently, the child of a SargableNode is not always a ScanNode after the substitution phase. This happens when the SargableMerge fails to merge two SargableNode (e.g. one of them has non-singleton disjunction requirement) in the substitution phase. Such SargableNode will remain in memo until the exploration phase.

Due to this, a SamplingEstimator may encounter such SargableNode and has to fall back to heuristic estimation without an additional check.
 
To address that:

  1. Create a SubstituteConvert<SargableNode> rewrite which converts SargableNode back to a FilterNode like what ExploreConvert<Sargablenode> does today by calling lowerSargableNode(sargableNode, ctx).
  2. Update the TODO in the sampling_estimator.cpp into an assertion such that the child of a SargableNode is always a ScanNode.

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