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

Extend ROUND() and FLOOR() to include number of decimal places to round up/down #2583

Closed
spena opened this issue Mar 19, 2019 · 1 comment
Closed
Assignees
Milestone

Comments

@spena
Copy link
Member

spena commented Mar 19, 2019

The functions ROUND() and FLOOR() currently accepts one single argument which will be rounded up or down to an integer.

We should extend these functions to accept a second argument that specifies the number of decimal places to round the value. This will be useful when users want to convert DECIMAL types (See #842) and a default rounding happens during conversion to a smaller scale.

Syntax to support:

  • ROUND(n [, d]) where n is the value to round up, and d is a number indicating up to how many decimal places In will be rounded.
    i.e.

ROUND(3.6456, 3) = 3.646
ROUND(3.6456, 2) = 3.65
ROUND(3.6456) = 4

  • FLOOR(n [, d]) where n is the value to round down, and d a number indicating the number of places after the decimal to which to round downward.
    i.e

FLOOR(3.6456, 3) = 3.645
FLOOR(3.6456, 2) = 3.64
FLOOR(3.6456) = 3

@spena spena added this to the 5.3 milestone Mar 19, 2019
@spena spena modified the milestones: 5.3, 5.4 Jun 7, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jun 28, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jun 28, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jun 29, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 5, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 5, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 12, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 12, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 12, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 12, 2019
ouertani added a commit to ouertani/ksql that referenced this issue Jul 12, 2019
@big-andy-coates big-andy-coates modified the milestones: 5.4, 0.7.0 Dec 2, 2019
@agavra agavra assigned purplefox and unassigned agavra Dec 18, 2019
@agavra
Copy link
Contributor

agavra commented Dec 18, 2019

This was fixed by #3404 - thanks @purplefox !

@agavra agavra closed this as completed Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants