Bug Report: Issues with IF function
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia caricando i dati allegati da tidb/tpcd.sql ed eseguendo entrambe le query SQL su TiDB 8.3.0, confrontando i relativi insiemi di risultati e il comportamento delle espressioni IF/IN. Il lavoro sarà completato quando sarà stato identificato il motivo per cui query logicamente equivalenti differiscono e sarà stato confermato che lo stesso caso produce risultati coerenti dopo la correzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
BugReport: Issues with IF function
version
8.3.0
Original sql
SELECT
O_CUSTKEY
FROM
orders
WHERE
(
O_COMMENT IN (
IF(
-1801656545 IS NOT NULL,
-1801656545,
)
)
) = 0.24036834733741486
GROUP BY
O_CUSTKEY ;
return 0 row
Rewritten sql
SELECT O_CUSTKEY
FROM orders
WHERE NOT EXISTS (
SELECT 1
WHERE O_COMMENT <> -1801656545 OR O_COMMENT IS NULL
) = 0.24036834733741486
GROUP BY O_CUSTKEY ;
return 101 row
Analysis
These two queries are logically equivalent, although they are written differently.
Original Query: The original query uses the IF function to check if -1801656545 is not NULL. If it is not NULL, it returns -1801656545; otherwise, it would return NULL (though in this specific query, -1801656545 is never NULL). It then uses IN to check if O_COMMENT matches the returned value and compares the result with 0.24036834733741486 to filter rows.
Rewritten Query: In the rewritten query, the NOT EXISTS subquery is used to check if O_COMMENT is not equal to -1801656545 or is NULL, which is logically equivalent to the IN check in the original query. The final result of the NOT EXISTS subquery is then compared with 0.24036834733741486 to filter the rows.
The two SQL queries are logically equivalent, but they return different results, indicating the presence of a bug.
How to repeat
The exported file for the database is in the attachment. : (https://github.com/LLuopeiqi/newtpcd/blob/main/tidb/tpcd.sql) .
- Lingua principale
- Python
- Stelle
- 616
- Fork
- 724
- Merge medio
- 2g 5h
- PR unite (30g)
- 168
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pingcap/docs
-
Weekly keywords check: mismatches foundForse già presa @saryn17 l’ha presa 57 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Broken Link DetectedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Weekly keywords check: mismatches foundForse già presa @saryn17 l’ha presa 57 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Broken Link DetectedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
tidb-cloud: Terraform import procedures need Terraform v1.5.0 or later, but the prerequisite says >=1.0Forse già presa @yahonda l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pingcap/docs
Issue simili
-
area:security effort:S priority:P3 status:needs-triage type:chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
randomparity/kdive#3657 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/mcp-proxy-for-aws#476 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(cli): a --root that does not exist exits 0 with 'Scanned 0 file(s)', so a wrong path in CI passes silentlyForse già presa @arpanjot-coding l’ha presa oggi. Apertaarea: runtime automation bug cli code-scanning consistency developer-experience difficulty: easy github-actions good first issue help wanted json-output priority: P3 python sarif silent-failure static-analysis tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
ContainsOnly raises TypeError for unhashable input with set-based choicesForse già presa @prathamchoksi l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
marshmallow-code/marshmallow#3115 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno