BugReport: Issues with EXCEPT function
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず、添付された tidb/tpcd.sql のデータを読み込み、TiDB 8.3.0 に対して両方の SQL クエリを実行して、結果が異なることを確認します。次に、EXCEPT と NOT IN のドキュメントまたは issue 領域を調査し、ドキュメントの修正が必要なのか、それとも不具合が TiDB エンジンのリポジトリに属するのかを判断します。差異を再現し、適切な修正場所を特定できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
BugReport: Issues with EXCEPT function
version
8.3.0
Original sql
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode NOT IN (
SELECT l_commitdate
FROM lineitem
) and l_shipmode is not null
and l_commitdate is not null
;
return 0 row
Rewritten sql
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode IS NOT NULL
AND l_commitdate IS NOT NULL
EXCEPT
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode IN (
SELECT l_commitdate
FROM lineitem
)AND l_shipmode IS NOT NULL
AND l_commitdate IS NOT NULL;
return 5905 row
Analysis
These two queries are logically equivalent, although they are written differently.
The original query filters rows using the NOT IN subquery, selecting rows where l_shipmode is not in the set of l_commitdate values from the lineitem table, and where both l_shipmode and l_commitdate are not NULL (using the IS NOT NULL condition). The result is all rows where l_shipmode is not in the l_commitdate set and both columns are not NULL.
In the rewritten query, the same logic is achieved using the EXCEPT operator. EXCEPT returns the results from the first query, but excludes rows that are present in the second query. Here, the first query returns all records where l_shipmode and l_commitdate are not NULL, and the second query excludes rows where l_shipmode is in the set of l_commitdate. The final result is the same as the original query.
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) .
- 主要言語
- Python
- スター
- 616
- フォーク
- 724
- 平均マージ
- 2日 5時間
- マージ済み PR(30日)
- 168
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pingcap/docs のほかの issue
-
Weekly keywords check: mismatches found対応中かも @saryn17 が 57 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Broken Link Detectedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
Weekly keywords check: mismatches found対応中かも @saryn17 が 57 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
Broken Link Detectedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
tidb-cloud: Terraform import procedures need Terraform v1.5.0 or later, but the prerequisite says >=1.0対応中かも @yahonda が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:security effort:S priority:P3 status:needs-triage type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
randomparity/kdive#3657 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aws/mcp-proxy-for-aws#476 ·
メンテナーはふだん 1 日以内に返信
-
fix(cli): a --root that does not exist exits 0 with 'Scanned 0 file(s)', so a wrong path in CI passes silently対応中かも @arpanjot-coding が今日担当しました。 オープンarea: 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
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
ContainsOnly raises TypeError for unhashable input with set-based choices対応中かも @prathamchoksi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
marshmallow-code/marshmallow#3115 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信