Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite: AddTicks translation gives incorrect results #29260

Closed
maumar opened this issue Oct 5, 2022 · 0 comments · Fixed by #29274
Closed

Sqlite: AddTicks translation gives incorrect results #29260

maumar opened this issue Oct 5, 2022 · 0 comments · Fixed by #29274
Assignees
Labels
area-query area-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. easy-for-smit Easy query bugs type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Oct 5, 2022

translation logic is as follows:

        else if (AddTicks.Equals(method))
        {
            modifier = _sqlExpressionFactory.Add(
                _sqlExpressionFactory.Convert(
                    _sqlExpressionFactory.Divide(
                        arguments[0],
                        _sqlExpressionFactory.Constant((double)TimeSpan.TicksPerDay)),
                    typeof(string)),
                _sqlExpressionFactory.Constant(" seconds"));
        }

it divides ticks by number of ticks in a day, but then adds the value as a number of seconds. We should be using TimeSpan.TicksPerSecond instead.

@ajcvickers ajcvickers added this to the Backlog milestone Oct 5, 2022
@ajcvickers ajcvickers added the easy-for-smit Easy query bugs label Oct 5, 2022
maumar added a commit that referenced this issue Oct 5, 2022
We were using TimeSpan.TicksPerDay rather than TicksPerSecond in the translation. Fixing the typo and correcting the test.

Fixes #29260
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 5, 2022
@maumar maumar modified the milestones: Backlog, 8.0.0 Oct 5, 2022
@ghost ghost closed this as completed in #29274 Oct 6, 2022
ghost pushed a commit that referenced this issue Oct 6, 2022
…29274)

We were using TimeSpan.TicksPerDay rather than TicksPerSecond in the translation. Fixing the typo and correcting the test.

Fixes #29260
@maumar maumar self-assigned this Nov 5, 2022
@ajcvickers ajcvickers modified the milestones: 8.0.0, 8.0.0-preview1 Jan 29, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview1, 8.0.0 Nov 14, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query area-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. easy-for-smit Easy query bugs type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants