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

[Bug] 文本类型小数无法使用bigint转数值,decimal(38,0) + decimal(38,8)的情况下会返回整数 #40956

Open
2 of 3 tasks
Jinxv1007 opened this issue Sep 19, 2024 · 2 comments

Comments

@Jinxv1007
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.1.5

What's Wrong?

文本类型小数无法使用bigint转数值
image
decimal(38,0) + decimal(38,8)的情况下会返回整数
image

What You Expected?

CAST("123.123" AS BIGINT) 能返回123而不是null;
CAST(123 AS DECIMAL(38,0))+CAST(123.123 AS DECIMAL(38,8) 返回小数而不是整数

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Mryange
Copy link
Contributor

Mryange commented Sep 19, 2024

CAST("123.123" AS BIGINT) 能返回123而不是null;

#38847
在这个pr里面支持了,但是没有合入到2.1的分支,合进了3.0.
之前的cast string to int的行为类似pg,比较严格。
https://dbfiddle.uk/OsHBViAA

@spihiker
Copy link

SELECT CAST(123.123 AS BIGINT);

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

No branches or pull requests

3 participants