4paradigm / 4paradigm/OpenMLDB

optimizer & runner should consider `NULL` special rules

オープン
#3,925 コメント 2 件 リアクション 0 件 担当者 1 名 @aceforeverd が担当を希望しています GitHub で見る
bug sql
主要言語
C++
スター
1.7k
フォーク
331
平均マージ
12日 12時間
マージ済み PR(30日)
1

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
sql
領域
backend, databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。