Skip to content

cast datetime as decimal wrong result #4151

@guo-shaoge

Description

@guo-shaoge

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table test.t1;
create table test.t1(c1 datetime(5));
insert into test.t1 values('2022-10-10 10:10:10.12345');
alter table test.t1 set tiflash replica 1;
set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp = 1; select cast(test.t1.c1 as decimal(17, 3)) from test.t1;

2. What did you expect to see? (Required)

mysql> select cast(test.t1.c1 as decimal(17, 3)) from test.t1;
+------------------------------------+
| cast(test.t1.c1 as decimal(17, 3)) |
+------------------------------------+
|                 20221010101010.123 |
+------------------------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select cast(test.t1.c1 as decimal(17, 3)) from test.t1;
+------------------------------------+
| cast(test.t1.c1 as decimal(17, 3)) |
+------------------------------------+
|                  1774256937300.572 |
+------------------------------------+
1 row in set (0.01 sec)

4. What is your TiFlash version? (Required)

master

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions