Details
-
Bug
-
Status: In Code Review
-
Major - P3
-
Resolution: Unresolved
-
None
-
None
-
None
-
Query Optimization
-
ALL
Description
A $natural hint or sort is supposed to take a direction: +1 or -1. But the parser allows other values, such as 0, NaN, or -0.01. In 5.0 and later we define safeNumberInt() < 0 to mean descending, which means 0, NaN and -0.01 are ascending. In 4.4 and earlier we use the unsafe numberInt(), so whether NaN is ascending or descending depends on the platform.
We should reject all of these inputs with a clear error. We should also consider using the number() < 0 idiom for consistency with index keys and sort patterns.
It looks like this doesn't affect other hints and sorts, because we either validate the SortPattern, or check that the hint matches to an existing index key.
Attachments
Issue Links
- is related to
-
SERVER-73194 [CQF] Allow hints to go through CQF
-
- In Code Review
-
-
SERVER-68309 Investigate for unsafe narrowing conversions
-
- Closed
-