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

cast string as datetime with time zone results in loss of precision #8754

Closed
SeaRise opened this issue Feb 4, 2024 · 1 comment · Fixed by #9255
Closed

cast string as datetime with time zone results in loss of precision #8754

SeaRise opened this issue Feb 4, 2024 · 1 comment · Fixed by #9255
Assignees
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/compute impact/wrong-result severity/major type/bug The issue is confirmed as a bug.

Comments

@SeaRise
Copy link
Contributor

SeaRise commented Feb 4, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!
related to pingcap/tidb#49555

1. Minimal reproduce step (Required)

use test;
drop table if exists t;
create table t(a varchar(50));
alter table test.t set tiflash replica 1;
insert into t values ('2020-01-01 12:00:00.123456 +0600 PST');
insert into t values ('2020-01-01 12:00:00.123456 -0600 PST');
set tidb_allow_mpp=1;set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash';
select cast(a as datetime(3)) from t;

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

+-------------------------+
| cast(a as datetime(3))  |
+-------------------------+
| 2020-01-01 12:00:00.123 |
| 2020-01-01 12:00:00.123 |
+-------------------------+

3. What did you see instead (Required)

+-------------------------+
| cast(a as datetime(3))  |
+-------------------------+
| 2020-01-01 12:00:00.000 |
| 2020-01-01 12:00:00.000 |
+-------------------------+

4. What is your TiFlash version? (Required)

v8.0.0-alpha-126-gc0476a0

@SeaRise SeaRise added type/bug The issue is confirmed as a bug. component/compute severity/major labels Feb 4, 2024
@SeaRise SeaRise changed the title Insert a special datetime with time_zone results in loss of precision cast string as datetime results in loss of precision Feb 4, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 4, 2024

related to pingcap/tidb#37820

@SeaRise SeaRise changed the title cast string as datetime results in loss of precision cast string as datetime with time zone results in loss of precision Feb 4, 2024
@SeaRise SeaRise added affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. labels Feb 18, 2024
@SeaRise SeaRise added may-affects-5.4 may-affects-6.1 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. labels Feb 18, 2024
@ti-chi-bot ti-chi-bot added the affects-8.1 This bug affects the 8.1.x(LTS) versions. label Apr 9, 2024
@solotzg solotzg self-assigned this Jul 26, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in #9255 Aug 9, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 7b17f5b Aug 9, 2024
ti-chi-bot bot pushed a commit that referenced this issue Sep 2, 2024
…ne or illegal chars (#9255) (#9354)

close #8754

Fix the wrong result bug when casting string as datetime with time zone or illegal chars
- func `getFracIndex` ignore time zone.
- func `parseFrac` ignore illegal suffix after microsecond format.

Signed-off-by: Zhigao Tong <[email protected]>

Co-authored-by: TONG,Zhigao <[email protected]>
Co-authored-by: Zhigao Tong <[email protected]>
Co-authored-by: TONG, Zhigao <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Sep 20, 2024
…ne or illegal chars (#9255) (#9352)

close #8754

Fix the wrong result bug when casting string as datetime with time zone or illegal chars
- func `getFracIndex` ignore time zone.
- func `parseFrac` ignore illegal suffix after microsecond format.

Signed-off-by: Zhigao Tong <[email protected]>

Co-authored-by: TONG,Zhigao <[email protected]>
Co-authored-by: Zhigao Tong <[email protected]>
Co-authored-by: TONG, Zhigao <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Oct 31, 2024
…ne or illegal chars (#9255) (#9353)

close #8754

Fix the wrong result bug when casting string as datetime with time zone or illegal chars
- func `getFracIndex` ignore time zone.
- func `parseFrac` ignore illegal suffix after microsecond format.

Signed-off-by: Zhigao Tong <[email protected]>

Co-authored-by: TONG,Zhigao <[email protected]>
Co-authored-by: Zhigao Tong <[email protected]>
Co-authored-by: TONG, Zhigao <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Oct 31, 2024
…ne or illegal chars (#9255) (#9351)

close #8754

Fix the wrong result bug when casting string as datetime with time zone or illegal chars
- func `getFracIndex` ignore time zone.
- func `parseFrac` ignore illegal suffix after microsecond format.

Signed-off-by: Zhigao Tong <[email protected]>

Co-authored-by: TONG,Zhigao <[email protected]>
Co-authored-by: Zhigao Tong <[email protected]>
Co-authored-by: TONG, Zhigao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/compute impact/wrong-result severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants