[Bug] GPORCA crashes the coordinator with dependencies extended statistics
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
调研方向
Start by running the reproduction SQL with optimizer = on to confirm the SIGSEGV and capture a backtrace. The payload points to CExtendedStatsProcessor.cpp, where colid_to_attno_mapping->Find(&colid) is dereferenced without a null check around lines 279 and 355/365, while the check near line 431 does test for null. Done means the query returns one row (NULL | NULL | f) with optimizer on and the crash no longer occurs, with a regression test added.
由索引模型根据 Issue 内容生成。
描述
Apache Cloudberry version
No response
What happened
Reproduce:
CREATE TABLE t1 (c0 name, c1 numeric, c2 boolean) DISTRIBUTED BY (c2);
INSERT INTO t1 VALUES ('a', 0.9, false), (NULL, NULL, false), ('', 0.1, false), ('1', 0.7, true), ('b', 0.5, NULL), ('', NULL, NULL), ('c', NULL, NULL);
CREATE STATISTICS s1 ON c0, c2 FROM t1;
CREATE STATISTICS s2 ON c1, c2 FROM t1;
ANALYZE t1;
SET optimizer = on;
SELECT * FROM (SELECT c0 AS a, c1 AS b, c2 AS c FROM t1 WHERE c2 IS FALSE) AS r WHERE r.a IS NULL AND r.b IS NULL AND r.c = FALSE;
-- server closed the connection unexpectedly
Expected: one row, NULL | NULL | f. That's what you get with optimizer = off, or with optimizer = on after dropping s1 and s2.
Actual: the coordinator backend crashes, and all other sessions are reset while the cluster recovers:
PANIC: Unexpected internal error: Master process received signal SIGSEGV
server process (PID ...) was terminated by signal 11: Segmentation fault
Stack (top frames):
gpnaucrates::CFilterStatsProcessor::MakeHistHashMapConjFilter
gpnaucrates::CFilterStatsProcessor::MakeStatsFilter
gpnaucrates::CFilterStatsProcessor::MakeStatsFilterForScalarExpr
gpopt::CLogicalSelect::PstatsDerive
gpopt::CExpressionHandle::DeriveRootStats
...
gpopt::CEngine::FinalizeExploration
Possible cause: MakeHistHashMapConjFilter calls CExtendedStatsProcessor::ApplyCorrelatedStatsToScaleFactorFilterCalculation. In that function, the result of colid_to_attno_mapping->Find(&colid) is dereferenced
without a null check (CExtendedStatsProcessor.cpp, around lines 279 and 355/365), while another call site (around line 431) does check for null. The filter here sits above a subquery and spans columns from two
different dependency statistics objects, which may produce a column ID with no mapping. I haven't confirmed this in a debugger.
What you think should happen instead
No response
How to reproduce
CREATE TABLE t1 (c0 name, c1 numeric, c2 boolean) DISTRIBUTED BY (c2);
INSERT INTO t1 VALUES ('a', 0.9, false), (NULL, NULL, false), ('', 0.1, false), ('1', 0.7, true), ('b', 0.5, NULL), ('', NULL, NULL), ('c', NULL, NULL);
CREATE STATISTICS s1 ON c0, c2 FROM t1;
CREATE STATISTICS s2 ON c1, c2 FROM t1;
ANALYZE t1;
SET optimizer = on;
SELECT * FROM (SELECT c0 AS a, c1 AS b, c2 AS c FROM t1 WHERE c2 IS FALSE) AS r WHERE r.a IS NULL AND r.b IS NULL AND r.c = FALSE;
-- server closed the connection unexpectedly
Operating System
any
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要语言
- C
- 星标
- 1.4k
- 派生
- 262
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 57
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/cloudberry 的其他 Issue
-
[Bug] Expand fails to recognize user-defined tablespaces可能已有人在做 @nix-oss 于 62 天前认领。 未关闭type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
apache/cloudberry#1885 · 2 个 reaction ·
维护者通常 3 天内回复
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)可能已有人在做 @talmacschen-arch 于 123 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
apache/cloudberry#1825 ·
维护者通常 3 天内回复
-
Lance support: contrib/lance_fdw and the MCP server's Lance tools可能已有人在做 @MisterRaindrop 于 3 天前认领。 未关闭
apache/cloudberry#2139 · 5 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
-
type: Bug
难度 3/5 半天 新手友好度 58/100
apache/cloudberry#2137 ·
维护者通常 3 天内回复
-
[Proposal] Remove `gpcontrib/gpmapreduce` starting from Cloudberry 3.0可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭type: Proposal
难度 4/5 3-5 天 新手友好度 22/100
apache/cloudberry#2136 · 1 条评论 ·
维护者通常 3 天内回复
查看 apache/cloudberry 的全部 Issue
相似的 Issue
-
Go device SDK: Whisper transcriber keeps buffering and transcribing audio appended after Stop()可能已有人在做 @apoorvdarshan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#22770 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
EchoTools/nevr-runtime#698 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
FujiNetWIFI/fujinet-firmware#2079 ·
维护者通常 1 天内回复
-
area:ci area:runtime-vm bug
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1859 ·
维护者通常 1 天内回复
-
bug Official Image release/25.12 Supported Device target/kirkwood
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复