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

builtins: add trunc(decimal, int) builtin #85890

Merged
merged 1 commit into from
Aug 13, 2022
Merged

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Aug 10, 2022

fixes #85620

Release note (sql change): Added the trunc(decimal, int) builtin
function, which truncates the given decimal value to the specified
number of decimal places. A negative value can be used for the scale
parameter, which will truncate to the left of the decimal point.

Example:

> select trunc(541.234, 2), trunc(541.234, 0), trunc(541.234, -1);

  trunc  | trunc | trunc
---------+-------+---------
  541.23 |   541 | 5.4E+2

@rafiss rafiss requested review from ZhouXing19 and a team August 10, 2022 14:34
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss force-pushed the trunc-2-arg branch 6 times, most recently from 2b7a857 to 49e3bd9 Compare August 11, 2022 21:38
@ZhouXing19
Copy link
Collaborator

The latest CI is still failing with

client_merge_test.go:4753: ranges unexpectedly unmerged expected startKey /Table/106/1/1, but got /Table/106/1/2

Could this be related to the oid changes?

@rafiss
Copy link
Collaborator Author

rafiss commented Aug 12, 2022

Where did you see those failures? I just see a data race for TestAdminAuditLogBasic which is caused by #85988 & #83080

@ZhouXing19
Copy link
Collaborator

I saw it from here, in TestMergeQueueWithSlowNonVoterSnaps. But I just test this commit locally and it passed, so I'm guessing it was just a flake...

Other than the CI failures everything LGTM!

@rafiss
Copy link
Collaborator Author

rafiss commented Aug 12, 2022

tftr!

bors r=ZhouXing19

@craig
Copy link
Contributor

craig bot commented Aug 12, 2022

Build failed:

Release note (sql change): Added the trunc(decimal, int) builtin
function, which truncates the given decimal value to the specified
number of decimal places. A negative value can be used for the scale
parameter, which will truncate to the left of the decimal point.

Example:
```
> select trunc(541.234, 2), trunc(541.234, 0), trunc(541.234, -1);

  trunc  | trunc | trunc
---------+-------+---------
  541.23 |   541 | 5.4E+2
```
@rafiss
Copy link
Collaborator Author

rafiss commented Aug 12, 2022

bors r=ZhouXing19

@craig
Copy link
Contributor

craig bot commented Aug 12, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 13, 2022

Build succeeded:

@craig craig bot merged commit 158ebe6 into cockroachdb:master Aug 13, 2022
@rafiss rafiss deleted the trunc-2-arg branch August 15, 2022 14:41
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.

sql: support trunc(decimal,int)
3 participants