unordered_map::at (std::out_of_range) planning EXPLAIN of a packed filtered count when the modulo-sum predicate uses a computed expression (e.g. offset(id(b)))
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in src/processor/map/map_aggregate.cpp at tryMapPackedFilteredCount(), then trace Schema::getExpressionPos() and the packed child schema lookups for the group key and predicate inputs. Reproduce the EXPLAIN query with enable_packed_path_extend=true and verify that computed predicate expressions no longer cause unordered_map::at; the plan should map or fall back gracefully while direct execution remains unchanged.
索引モデルが issue の本文から書いたものです。
説明
What happens?
Planning the following query with EXPLAIN crashes with Error: unordered_map::at (a std::out_of_range escaping as an error, not a segfault). The same query without EXPLAIN executes fine, so the failure is in plan mapping on the EXPLAIN path.
The throw originates in Schema::getGroupPos(name) (unordered_map::at) reached via:
#2 lbug::planner::Schema::getGroupPos(std::string const&) const
#3 lbug::planner::Schema::getGroupPos(lbug::binder::Expression const&) const
#4 lbug::planner::Schema::getExpressionPos(lbug::binder::Expression const&) const
#5 lbug::processor::PlanMapper::mapAggregate(lbug::planner::LogicalOperator const*)
i.e. tryMapPackedFilteredCount() (src/processor/map/map_aggregate.cpp) calls packedChildSchema->getExpressionPos(...) on the group key and on the two predicate inputs of the (lhs + rhs) % k = 0 filter. When a predicate input is a plain property (b.id) the lookup succeeds; when it is a computed expression over the nbr internal ID (offset(id(b))) the expression is not found in the packed child schema by unique name and .at() throws.
Repro
-- any database with a two-column int64 PK node table and a rel table; e.g.:
CREATE NODE TABLE MPerson(id INT64, PRIMARY KEY(id));
CREATE REL TABLE MKnows(FROM MPerson TO MPerson);
-- (populate some edges)
CALL enable_packed_path_extend=true;
EXPLAIN MATCH (a:MPerson)-[e:MKnows]->(b:MPerson)
WHERE (a.id + offset(id(b))) % 10 = 0
RETURN a.id, COUNT(*);
Error: unordered_map::at
Observed on the current main build (pre-existing; found while testing #867, which only touches this code path's gating and does not change the crash).
Conditions (verified on a 3000-node / 6750-edge MPerson/MKnows database)
| # | config | query shape | result |
|---|---|---|---|
| A | enable_packed_path_extend=true + EXPLAIN |
keyed COUNT(*), predicate (a.id + offset(id(b))) % 10 = 0 |
crash (unordered_map::at) |
| B | enable_packed_path_extend=false + EXPLAIN |
same | OK |
| C | enable_packed_path_extend=true + EXPLAIN |
same, but predicate (a.id + b.id) % 10 = 0 (plain property) |
OK |
| D | enable_packed_path_extend=true + EXPLAIN |
global COUNT(*) (no group key), offset predicate |
OK |
| — | enable_packed_path_extend=true, no EXPLAIN |
same as A | OK (executes and returns correct rows) |
So all three ingredients are required: the packed-filtered-count mapping pattern (keyed count(*) over a single modulo-sum filter above a packed extend), a predicate input that is a computed expression rather than a property, and the EXPLAIN statement (non-EXPLAIN execution of the same query does not hit the throwing lookup).
Expected
Either the plan maps (the schema should contain, or the mapper should resolve, the mapped form of the predicate input expressions), or tryMapPackedFilteredCount should bail out gracefully (return nullptr) when the key/predicate-input expressions cannot be located in packedChildSchema, falling back to the regular aggregate plan.
Suggested fix direction
In tryMapPackedFilteredCount, the lookups packedChildSchema->getExpressionPos(*key) / getExpressionPos(*predicateInputs->first|second) assume the binder expressions appear verbatim in the packed child schema. For computed expressions (e.g. offset(id(b))) the planned schema holds a different expression object for the same unique name, or holds nothing at all. Guard these lookups (e.g. Schema::containsExpression(...)-style check, or try/catch around getGroupPos) and fall back to the standard aggregate mapping when they fail. It may also be worth checking why the EXPLAIN path differs from direct execution for the same query.
- 主要言語
- C++
- スター
- 1.8k
- フォーク
- 148
- 平均マージ
- 14時間 57分
- マージ済み PR(30日)
- 124
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
LadybugDB/ladybug のほかの issue
-
Bug: SET p.prop = NULL ... RETURN p.prop returns the old value for every row except the first対応中かも @Tyagiquamar が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Planner follow-ups from #1125 review: null outerAccumulate segfault under enable_plan_optimizer=false, no cost guard for the correlated-PK chain, and late filter-scope errors対応中かも @Tyagiquamar が 1 日前に担当しました。 オープンbug
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
Bug: is_sorted assertion in scanCommittedInMem after a failed checkpoint with deleted in-memory relsオープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
LadybugDB/ladybug#1117 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
LadybugDB/ladybug の issue をすべて見る
似ている issue
-
Component: Python API
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Vector35/binaryninja-api#8649 ·
メンテナーはふだん 3 日以内に返信
-
ai_p2 comp-parquet-reader-v3
難易度 2/5 半日 初心者へのやさしさ 66/100
ClickHouse/ClickHouse#124986 ·
メンテナーはふだん 1 日以内に返信
-
bug product: very_good_flutter_plugin
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
VeryGoodOpenSource/very_good_templates#654 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AcademySoftwareFoundation/OpenImageIO#5550 ·
メンテナーはふだん 2 日以内に返信