Skip to content

Follow the SQL standard in cast from double or real to varchar#10657

Merged
kasiafi merged 2 commits intotrinodb:masterfrom
kasiafi:295CastToVarcharApproxNumericFixFormat
Jan 21, 2022
Merged

Follow the SQL standard in cast from double or real to varchar#10657
kasiafi merged 2 commits intotrinodb:masterfrom
kasiafi:295CastToVarcharApproxNumericFixFormat

Conversation

@kasiafi
Copy link
Copy Markdown
Member

@kasiafi kasiafi commented Jan 18, 2022

Related to #552

@kasiafi kasiafi force-pushed the 295CastToVarcharApproxNumericFixFormat branch from 799ef4f to 0572fa4 Compare January 18, 2022 13:42
@cla-bot cla-bot bot added the cla-signed label Jan 18, 2022
@kasiafi kasiafi force-pushed the 295CastToVarcharApproxNumericFixFormat branch 2 times, most recently from 467e3cd to 323ee7c Compare January 19, 2022 10:00
@kasiafi kasiafi requested a review from findepi January 19, 2022 12:32
@kasiafi kasiafi force-pushed the 295CastToVarcharApproxNumericFixFormat branch from 323ee7c to 9359d9c Compare January 20, 2022 10:35
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

provide original value in the message, just in case we screw something up:

"Value %s (%s) ...", value, stringValue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Applied to both double and real.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or, arguably more directly, Double.compare(0.0, value) == 0
the Double.compare sorts negative zero before positive zero

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's clearer the way it is. Double.compare would require a comment.

@kasiafi kasiafi force-pushed the 295CastToVarcharApproxNumericFixFormat branch from 9359d9c to 7bb9d8f Compare January 20, 2022 13:13
@kasiafi kasiafi force-pushed the 295CastToVarcharApproxNumericFixFormat branch from 7bb9d8f to ce125d0 Compare January 20, 2022 20:06
@kasiafi kasiafi merged commit 196072e into trinodb:master Jan 21, 2022
@github-actions github-actions bot added this to the 369 milestone Jan 21, 2022
@kasiafi kasiafi mentioned this pull request Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants