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

Use the proper type mapping for the result of AVG #35023

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

ChrisJollyAU
Copy link
Contributor

The translation of Average in Cosmos uses the same type mapping of its input for its return.

While this is fine if its input is a float, double, decimal, if you have an int or long as input it sets the return type as the same, thus causing a truncation when the results are read.

This fixes it by using the resultType passed in (the result type of the C# Average method - either float or double)

Fixes #26378

@ChrisJollyAU ChrisJollyAU requested a review from a team as a code owner October 31, 2024 09:43
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

@ChrisJollyAU thanks for fixing this!

I'm approving, but see my nit comment - will delay merging for that for now.

@roji roji enabled auto-merge (squash) October 31, 2024 10:58
@roji roji merged commit 507e7f1 into dotnet:main Oct 31, 2024
7 checks passed
@ChrisJollyAU ChrisJollyAU deleted the cosmosavgtrunc branch October 31, 2024 14:29
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.

Cosmos: Average truncates results
2 participants