dotnet / dotnet/efcore

Cosmos: TimeOnly arithmetic is translated incorrectly

Open
#35,311 5 comments 0 reactions 0 assignees View on GitHub
area-cosmos area-query
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

The following test:

```c#
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task TimeOnly_subtract_TimeOnly(bool async)
=> AssertQuery(
async,
ss => ss.Set().Where(b => b.TimeOnly - new TimeOnly(10, 0, 0) == new TimeSpan(0, 0, 15, 50, 500)));
```

... generates the following SQL:

```sql
SELECT VALUE c
FROM root c
WHERE ((c["TimeOnly"] - "10:00:00") = "00:15:50.5000000")
```

We should either correct the translation or block it. Check arithmetic over other temporal types to make sure we're doing the right thing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.