4paradigm / 4paradigm/OpenMLDB

optimizer & runner should consider `NULL` special rules

Aperta
#3,925 2 commenti 0 reazioni 1 assegnatario Rivendicata da @aceforeverd Vedi su GitHub
bug sql
Lingua principale
C++
Stelle
1.7k
Fork
331
Merge medio
12g 12h
PR unite (30g)
1

Descrizione

For a index optimizer, the most common pattern is, for example, SQL `SELECT * FROM t1 WHERE gp = {const_val}`, is optimized based on FILTER expression `gp = {const_val}`:

So if index `key=gp` exists for table t1, that index is utilized, as ** SEEK BY KEY `{const_val}` >> OUTPUT ALL ROWS`**.

However, if `{const_val}` is `NULL`, this optimize rule should not go that approach, since ` = NULL` is `NULL`.

This also happens for SQL like LAST JOIN `t1 LAST JOIN t2 on t1.key = t2.key`, where there is row exists in t1 that `t1.key = NULL`. It never joins.

Optimizer should consider const NULL values, and Runner should consider NULL values as index_key

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

The issue describes optimizer and runner logic for handling NULL values in index lookups and joins. Look for optimizer code that handles filter expressions like 'gp = {const_val}' and index seek logic. Examine join implementations, particularly LAST JOIN, to see how NULL key equality is currently treated. Testing involves verifying that queries with NULL constants do not incorrectly use indexes and that joins behave correctly with NULL keys.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
sql
Ambito
backend, databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.