You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] GPORCA crashes the coordinator with dependencies extended statistics #2135
CREATETABLEt1 (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 WHEREr.a IS NULLANDr.b IS NULLANDr.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
CREATETABLEt1 (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 WHEREr.a IS NULLANDr.b IS NULLANDr.c= FALSE;
-- server closed the connection unexpectedly
Activity
[Cloudberry] Add PQS, TLP and DQP test oracles
[Cloudberry] Add PQS, TLP and DQP test oracles
yjhjstz commentedon Oct 16, 2026
related #1966