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

Tikv cast string as decimal function inconsistent behavior with tidb #51879

Closed
Tracked by #51876
yibin87 opened this issue Mar 19, 2024 · 5 comments
Closed
Tracked by #51876

Tikv cast string as decimal function inconsistent behavior with tidb #51879

yibin87 opened this issue Mar 19, 2024 · 5 comments

Comments

@yibin87
Copy link
Contributor

yibin87 commented Mar 19, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set tidb_opt_projection_push_down = 'on';
Case1
create table t1(s1 time);
insert into t1 values ('11:11:11');
select cast(s1 as decimal(7,2)) from t1;
--Expect
99999.99
--Actual
100000

Case2
set tidb_opt_projection_push_down = 'on';
CREATE TABLE t1 (v varchar(10), tt tinytext, t text, mt mediumtext, lt longtext);
INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
--Expect
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
1 2 3 4 5
--Actual
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
1.00 2.00 3.00 4.00 5.00

2. What is your TiDB version? (Required)

| Release Version: v7.4.0-alpha-2012-gfe01d11df6-dirty
Edition: Community
Git Commit Hash: fe01d11
Git Branch: div_increase_prec
UTC Build Time: 2024-03-15 08:10:07

@yibin87 yibin87 added the type/bug The issue is confirmed as a bug. label Mar 19, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Mar 19, 2024

Checked tidb is consistent with mysql

@yibin87
Copy link
Contributor Author

yibin87 commented Mar 19, 2024

/assign @yibin87

@yibin87 yibin87 changed the title Tikv inconsistent cast string as decimal with tidb Tikv inconsistent cast string as decimal behavior with tidb Mar 19, 2024
@yibin87 yibin87 changed the title Tikv inconsistent cast string as decimal behavior with tidb Tikv cast string as decimal inconsistent behavior with tidb Mar 19, 2024
@yibin87 yibin87 changed the title Tikv cast string as decimal inconsistent behavior with tidb Tikv cast string as decimal function inconsistent behavior with tidb Mar 19, 2024
@aytrack aytrack added the sig/execution SIG execution label Mar 19, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 1, 2024

/assign @gengliqi

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 17, 2024

#52644, tikv also differs from tidb in whether produces warning msgs.

@gengliqi
Copy link
Contributor

gengliqi commented Apr 25, 2024

should be closed due to tikv/tikv#16913 is closed

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

5 participants