Skip to content

fix AVG over nullable int?/long? window#67

Merged
koenbeuk merged 2 commits into
mainfrom
fix/avg-window-nullable-fix
Jun 1, 2026
Merged

fix AVG over nullable int?/long? window#67
koenbeuk merged 2 commits into
mainfrom
fix/avg-window-nullable-fix

Conversation

@koenbeuk
Copy link
Copy Markdown
Collaborator

@koenbeuk koenbeuk commented Jun 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings June 1, 2026 03:03
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ure/Internal/WindowFunctionMethodCallTranslator.cs 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes AVG window translation for nullable integer inputs so int?/long? averages are cast to floating-point SQL before aggregation, matching the API’s double? return semantics.

Changes:

  • Casts AVG integer arguments to double instead of the method return type.
  • Extends float-cast detection to nullable double? AVG overloads.
  • Adds an integration test covering nullable int AVG producing 1.5 instead of integer-truncated 1.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ExpressiveSharp.EntityFrameworkCore.RelationalExtensions/Infrastructure/Internal/WindowFunctionMethodCallTranslator.cs Updates AVG translation logic for nullable integer inputs.
tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests/Infrastructure/WindowFunctionTestBase.cs Adds coverage for nullable integer AVG casting behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

PostgreSQL renders the float cast as `::double precision` rather than the
`CAST(... AS ...)` keyword, so the literal "CAST" assertion failed only on
Postgres. Accept either cast idiom.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@koenbeuk koenbeuk merged commit 55d9ce4 into main Jun 1, 2026
17 checks passed
@koenbeuk koenbeuk deleted the fix/avg-window-nullable-fix branch June 1, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants