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

Round() and Round_Even() return different type #11930

Open
1 of 2 tasks
manticore-projects opened this issue May 4, 2024 · 1 comment
Open
1 of 2 tasks

Round() and Round_Even() return different type #11930

manticore-projects opened this issue May 4, 2024 · 1 comment

Comments

@manticore-projects
Copy link

What happens?

Round() returns Decimal while Round_Even returns Double.
It should be consistent, especially since you made casting must more strict and explicit in 0.10

To Reproduce

-- expected
SELECT typeof(ROUND(2.5, 0)) AS r1, typeof(ROUND_EVEN(2.5, 0)) AS r2;

-- result
/*
┌──────────────┬────────┐
│ r1           │ r2     │
├──────────────┼────────┤
│ DECIMAL(2,0) │ DOUBLE │
└──────────────┴────────┘
*/

OS:

Linux

DuckDB Version:

0.10.2

DuckDB Client:

Java

Full Name:

Andreas Reichel

Affiliation:

manticore-projects.com

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@manticore-projects manticore-projects changed the title Round() and Round_Even() return different time Round() and Round_Even() return different type May 4, 2024
@hannes
Copy link
Member

hannes commented May 6, 2024

The round function predates the decimal type, so that's probably why. I agree it should be consistent though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants