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

Databend CI error: Decimal overflow #791

Open
ZhengLin-Li opened this issue May 23, 2023 · 2 comments · Fixed by datafuselabs/databend#15574
Open

Databend CI error: Decimal overflow #791

ZhengLin-Li opened this issue May 23, 2023 · 2 comments · Fixed by datafuselabs/databend#15574

Comments

@ZhengLin-Li
Copy link
Contributor

I am investigating the CI error of databend.

It seems that this line of SQL:

CREATE TABLE t1(c0FLOAT DOUBLE NOT NULL);
INSERT INTO t1(c0float) VALUES (0.17081978917121887);
SELECT SUM(count) FROM (SELECT (((0.9505856037139893 NOT BETWEEN 0.7793450355529785 AND 9.69433728E8) IS NOT NULL AND (0.9505856037139893 NOT BETWEEN 0.7793450355529785 AND 9.69433728E8)) ::BIGINT)as count FROM t1) as res;

resulted in a decimal overflow error:

Decimal overflow at line : 906 while evaluating function `to_decimal(25, 16)(969433728)`

But I do not quite understand why there is a function to_decimal(25, 16), and why the values here are 25 and 16.

The column c0 of table t1 is of type float, and according to https://docs.databend.com/sql/sql-reference/data-types/data-type-numeric-types/#floating-point-data-types, we actually can store the value 9.69433728E8 in c0 of t1

But I looked up the documentation of Databend: https://databend.rs/doc/sql-reference/data-types/data-type-decimal-types I found that our value of 9.69433728E8 actually exceeds its limit of to_decimal(25, 16).

So I am confused if there is a bug in Databend, or there is a bug in SQLancer?

The full log: https://github.com/ZhengLin-Li/sqlancer/actions/runs/5053760996/jobs/9067927554

@mrigger
Copy link
Contributor

mrigger commented May 24, 2023

I think it would be helpful to further reduce the test case to figure out what causes the conversion (e.g., is it the cast to BIGINT?). @hanyisong, do you have any feedback on this?

@malwaregarry
Copy link
Contributor

I made a bug report: datafuselabs/databend#15568

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 a pull request may close this issue.

3 participants