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

Fix to #10537 - Specified cast not valid when using min or max after decimal to float cast #10960

Merged
merged 1 commit into from
Feb 14, 2018

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Feb 14, 2018

Problem was that as part of fixing #8652 we were removing explicit casts when processing result operators. This is fine for most aggregate operators, but is not correct for Min/Max. This is because the final result type is the same as the argument - original type of the argument must be preserved or we risk type mismatches in the final result.

Additionally improved the fix for #1251 - we should be stripping order by clauses for Min/Max operators as well. Previously we exempt all ChoiceResultOperatorBase, instead of correct First/Single/Last.

…r decimal to float cast

Problem was that as part of fixing #8652 we were removing explicit casts when processing result operators. This is fine for most aggregate operators, but is not correct for Min/Max. This is because the final result type is the same as the argument - original type of the argument must be preserved or we risk type mismatches in the final result.

Additionally improved the fix for #1251 - we should be stripping order by clauses for Min/Max operators as well. Previously we exempt all ChoiceResultOperatorBase, instead of correct First/Single/Last.
@@ -276,7 +276,9 @@ var fromClauseData
public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
{
if (resultOperator is ValueFromSequenceResultOperatorBase
&& !(resultOperator is ChoiceResultOperatorBase)
&& !(resultOperator is FirstResultOperator)
Copy link
Member

Choose a reason for hiding this comment

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

regression test for this?

@maumar maumar merged commit fdb54d9 into dev Feb 14, 2018
@smitpatel smitpatel deleted the fix10537 branch February 14, 2018 03: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.

None yet

2 participants