Allow safe numerical comparisons across types
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
The `NorthwindWhereQueryTestBase.Where_equals_*_on_mismatched_types` tests assert that equality between two *different numeric CLR types* must return false. Mongo naturally handles these comparisons, as do other databases. It seems inline with EF Core philosophy that we allow these comparisons to translate.
The behavior was determined by-design in 2015 with [#1858: Filter missing if wrong type passed in](#1858). This was a long time ago and I suspect the full consequences were not properly understood, or may have been dismissed because of the complexity of handling this in the LINQ provider at that time.
We could choose to include floating point comparisons or not, since this might not work as the user intended, just like with any float comparisons.
Contributor guide
Research direction
Start with the NorthwindWhereQueryTestBase.Where_equals_*_on_mismatched_types tests and trace how their numeric comparisons are translated by the LINQ provider. Define which mismatched numeric types, including floating-point types, should be supported and verify that the tests return the intended results without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100