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

Support round long function for decimal places < 0 #10349

Closed
wants to merge 1 commit into from
Closed

Support round long function for decimal places < 0 #10349

wants to merge 1 commit into from

Conversation

ebyhr
Copy link
Contributor

@ebyhr ebyhr commented Apr 9, 2018

Fix #10025

@@ -763,14 +763,28 @@ public void testRound()

assertFunction("round(TINYINT '3', TINYINT '0')", TINYINT, (byte) 3);
assertFunction("round(TINYINT '3', 0)", TINYINT, (byte) 3);
assertFunction("round(TINYINT '9', -1)", TINYINT, (byte) 10);
assertFunction("round(TINYINT '-9', -1)", TINYINT, (byte) -10);
Copy link
Contributor

Choose a reason for hiding this comment

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

add cases

  • (12, -1) → 10
  • (18, -1) → 20

assertFunction("round( 3000000000, 0)", BIGINT, 3000000000L);
assertFunction("round(-3000000000, 0)", BIGINT, -3000000000L);
assertFunction("round( 3999999999, -1)", BIGINT, 4000000000L);
assertFunction("round(-3999999999, -1)", BIGINT, -4000000000L);
Copy link
Contributor

Choose a reason for hiding this comment

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

add a cases

  • (9223372036854775807, -3)
  • (9223372036854775807, -19) (should overflow)
  • (9223372036854775807, -20)
  • (9223372036854775807, -2147483648)

assertFunction("round(-3, INTEGER '0')", INTEGER, -3);
assertFunction("round(99, INTEGER '-1')", INTEGER, 100);
assertFunction("round(-99, INTEGER '-1')", INTEGER, -100);
Copy link
Contributor

Choose a reason for hiding this comment

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

add case

  • (12355, -2) → 12400)
  • (12345, -2) → 12300)
  • (2147483647, -9) → 2000000000
  • (2147483647, -10) → 0
  • (2147483647, -100) → 0
  • (2147483647, -2147483648) → 0

@ebyhr
Copy link
Contributor Author

ebyhr commented Apr 17, 2018

I'm sorry but I close this PR because it seems it's not simpler than my expected and I don't have much time. If I find a better way to fix, I may reopen this PR though.

@ebyhr ebyhr closed this Apr 17, 2018
@findepi
Copy link
Contributor

findepi commented Apr 17, 2018

@ebyhr please keep this open. If you don't have the time to continue, someone may take this over.

@ebyhr ebyhr reopened this Apr 17, 2018
@ebyhr
Copy link
Contributor Author

ebyhr commented Apr 17, 2018

@findepi I see :) Reopened.

@stale
Copy link

stale bot commented Apr 3, 2019

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the task, make sure you've addressed reviewer comments, and rebase on the latest master. Thank you for your contributions!

@stale stale bot added the stale label Apr 3, 2019
@stale stale bot closed this Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants