Fix SQL Server translation of IndexOf#33876
Conversation
| SELECT 0 | ||
| SELECT CASE | ||
| WHEN [c].[ContactName] IS NOT NULL THEN 0 | ||
| END |
There was a problem hiding this comment.
the fact that this test was passing is related to the fact that the dataset is initialized with a specific set of values; in particular, even though the ContactName column is nullable, none of the records in the dataset have a null ContactName
There was a problem hiding this comment.
could switch to using Region instead of ContactName:
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Select_with_complex_expression_that_can_be_funcletized(bool async)
=> AssertQueryScalar(
async,
ss => ss.Set<Customer>().Where(c => c.CustomerID == "ALFKI").Select(c => (int?)c.Region.IndexOf("")),
ss => ss.Set<Customer>().Where(c => c.CustomerID == "ALFKI").Select(c => c.Region == null ? (int?)null : 0),
assertOrder: true);There was a problem hiding this comment.
I started using Region in two tests that were explicitly testing the behavior of IndexOf("") and, as expected, they started failing on SQL Server unless the patch is applied. Thank you for your suggestion! @maumar
Unfortunately this change also introduces a failure on Cosmos... I guess it's time for me to try and install the cosmos emulator
|
I updated the Cosmos baselines (this is the delta), but apparently several tests are currently failing on the main branch (hence also on the merged PR+main). |
This change causes additional failures in SQL Server because its translation does not propagates nulls.
so that it propagates nullability in the standard way.
|
thanks @ranma42 ! |
This updates the translation of
IndexOfon SQL Server so that it propagates nullability in the standard way.This fixes the mismatch reported in #18773 (comment) and effectively aligns it with the current behavior of the SQLite translation.
Fixes #18773