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

Unexpected Results in TiFlash #46599

Open
bajinsheng opened this issue Sep 1, 2023 · 8 comments
Open

Unexpected Results in TiFlash #46599

bajinsheng opened this issue Sep 1, 2023 · 8 comments

Comments

@bajinsheng
Copy link

Bug Report

1. Minimal reproduce step (Required)

CREATE TABLE t0(c0 CHAR);
INSERT INTO t0 VALUES ('1');
ALTER TABLE t0 SET TIFLASH REPLICA 1;

SELECT SLEEP(5);
EXPLAIN SELECT t0.c0 FROM t0 WHERE CAST((t0.c0 NOT LIKE t0.c0) AS DATE)<FLOOR(t0.c0); -- {}
EXPLAIN SELECT /*+ READ_FROM_STORAGE(TIKV[t0])*/t0.c0 FROM t0 WHERE CAST((t0.c0 NOT LIKE t0.c0) AS DATE)<FLOOR(t0.c0); -- {1}

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

3. What did you see instead (Required)

Both queries return different results.

4. What is your TiDB version? (Required)

| Release Version: v7.3.0
Edition: Community
Git Commit Hash: 40b72e7a9a4fc9670d4c5d974dd503a3c6097471
Git Branch: heads/refs/tags/v7.3.0
UTC Build Time: 2023-08-08 10:08:14
GoVersion: go1.20.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv |

Startup command:

tiup playground 7.3.0
@bajinsheng bajinsheng added the type/bug This issue is a bug. label Sep 1, 2023
@bajinsheng
Copy link
Author

/label fuzz/sqlancer

@jebter
Copy link

jebter commented Sep 4, 2023

In 6.5.4, both queries returned 1

@ti-chi-bot ti-chi-bot bot added may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Sep 4, 2023
@windtalker
Copy link
Contributor

root cause is TiFlash return null for cast(0 as date), this is actually expected in a sql mode that has NO_ZERO_IN_DATE

@jebter
Copy link

jebter commented Sep 21, 2023

/remove- severity critical
/severity major

@jebter
Copy link

jebter commented Sep 21, 2023

/remove-severity critical

@bajinsheng
Copy link
Author

I removed the NO_ZERO_IN_DATE in sql_mode, but I still observed the same results.

CREATE TABLE t0(c0 CHAR);
INSERT INTO t0 VALUES ('1');
ALTER TABLE t0 SET TIFLASH REPLICA 1;
SET sql_mode='';

SELECT SLEEP(5);
SELECT t0.c0 FROM t0 WHERE CAST((t0.c0 NOT LIKE t0.c0) AS DATE)<FLOOR(t0.c0); -- {}
SELECT /*+ READ_FROM_STORAGE(TIKV[t0])*/t0.c0 FROM t0 WHERE CAST((t0.c0 NOT LIKE t0.c0) AS DATE)<FLOOR(t0.c0); -- {1}

@windtalker
Copy link
Contributor

Yes, SQL mode is not supported well in TiDB/TiKV/TiFlash :(

@yibin87
Copy link
Contributor

yibin87 commented Apr 1, 2024

/assign @solotzg

@solotzg solotzg removed their assignment May 13, 2024
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

6 participants