pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.01k stars 5.82k forks source link

Problems encountered when using the right join elt function together #42377

Open DBMSTesting opened 1 year ago

DBMSTesting commented 1 year ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Table building statement: CREATE TABLE t0(c0 BOOL ZEROFILL CHECK (CAST(c0 AS CHAR)) DEFAULT NULL ) AUTO_ID_CACHE 100 ; CREATE TABLE t1 LIKE t0; UPDATE t0 SET c0=''; set @@tidb_index_lookup_join_concurrency=24; UPDATE t1 SET c0='T' WHERE ((960554197)<(1891121875)); ALTER TABLE t1 ORDER BY c0 DESC; CREATE VIEW v0(c0) AS SELECT -6.17552593E8 FROM t0 WHERE ((NULL)REGEXP((CASE (('{')>=(CAST((NOT ('-519386198')) AS DATE))) WHEN (((((~ (NULL))) IS NOT NULL))NOT REGEXP(((t0.c0)LIKE(CAST(t0.c0 AS CHAR))))) THEN ELT('&tc>', true) ELSE FIELD(NULL, -2102583696) END ))) ORDER BY CAST(-1805859464 AS DECIMAL); TRUNCATE t0; ALTER TABLE t0 ADD PRIMARY KEY(c0); UPDATE t1 SET c0=-1715911751; set @@tidb_opt_join_reorder_threshold=0; INSERT LOW_PRIORITY IGNORE INTO t0 VALUES (''); ALTER TABLE t1 CHANGE c0 c0 BOOL NOT NULL ; UPDATE t1 SET c0=702875037 WHERE t1.c0; set @@tidb_index_lookup_join_concurrency=1;

Statement that triggers a bug: SELECT v0.c0,t0.c0 FROM v0 RIGHT JOIN t0 ON t0.c0 WHERE ((ELT(t0.c0, 'e', NULL, ((v0.c0) IS NULL))) IS NULL);

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

Return a piece of data [null,0]

3. What did you see instead (Required)

No data returned

4. What is your TiDB version? (Required)

6.6.0

hawkingrei commented 1 year ago

How do you find this bug? Are you using sqlancer ?

DBMSTesting commented 1 year ago

How do you find this bug? Are you using sqlancer ?

Our job is to complete the writing of an Oracle by ourselves, and the selected test case generation tool is sqleaner. To put it simply, we use sqleaner to generate test cases, and then test them on our own Oracle

DBMSTesting commented 1 year ago

How do you find this bug? Are you using sqlancer ?

Hello, has this error been detected? Could you please tell me whether the five questions I have reported are confirmed or repeated