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]: correlated MAX subquery panics with two range bounds and an unused column #32440
Container architecture: Linux arm64, running on macOS arm64
Actual Behavior
A correlated scalar subquery using MAX and two bounds on the same inner column returns an internal panic. It reproduced 3/3 times in a fresh database with one row in each table:
ERROR 20101 (HY000): internal error: panic runtime error: index out of range [2] with length 2
runtime.panicBounds64
github.com/matrixorigin/matrixone/pkg/sql/colexec.(*ColumnExpressionExecutor).Eval
pkg/sql/colexec/evalExpression.go:1194
Expected Behavior
The query should return one row containing 1, without an internal error.
Steps to Reproduce
Run the following in an empty test database:
CREATETABLEparent (id INT, ceiling BIGINT);
CREATETABLEchild (unused INT, parent_id INT, event_idx BIGINT);
INSERT INTO parent VALUES (1, 49);
INSERT INTO child VALUES (0, 1, 1);
SELECT (
SELECTMAX(c.event_idx)
FROM child AS c
WHEREc.parent_id=p.idANDc.event_idx>-1ANDc.event_idx<=p.ceiling
)
FROM parent AS p;
Additional information
Removing the unused first column from child makes the query return 1.
Keeping the original schema and replacing MAX(c.event_idx) with c.event_idx ORDER BY c.event_idx DESC LIMIT 1 also returns 1.
No index is needed for the reproduction.
A similar correlated MAX query on a wider real schema instead produced panic unsafe slice cast: from length 8 is not enough for length 24; it is not yet established whether that is the same underlying defect.
All reproduction data above is synthetic; the temporary database was removed after testing.
Activity
XuPeng-SH commentedon Nov 10, 2026
already fixed by #26827 and #31512