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]: ORDER BY on a const-null projection panics in FixedLengthShuffle #26871
08770e1beeb2 (v0.7.1-0.20260808145103-08770e1beeb2+dirty); 4.2-dev base 9301a23cc8f7c36aa0791b420aad8ed52e2ad3e6
Other Environment Information
Hardware parameters: local single-node MatrixOne, CN/TN memory cache 6 GB
OS type: Debian Linux 6.12.43 x86_64
Others: MySQL protocol port 6001
Actual Behavior
The query returns an internal panic instead of rows:
ERROR 20101 (HY000): internal error: panic runtime error: index out of range [0] with length 0
...
github.com/matrixorigin/matrixone/pkg/vectorize/shuffle.FixedLengthShuffle
pkg/vectorize/shuffle/shuffle.go:23
github.com/matrixorigin/matrixone/pkg/container/vector.(*Vector).Shuffle
pkg/container/vector/vector.go:2102
github.com/matrixorigin/matrixone/pkg/container/batch.(*Batch).Shuffle
pkg/container/batch/batch.go:827
github.com/matrixorigin/matrixone/pkg/sql/colexec/order.(*container).sortAndSend
pkg/sql/colexec/order/order.go:66
White-box observation: the projected INET_NTOA(NULL) is represented as a payload-free, zero-length const-null vector with a positive batch row count. The order operator passes it to Batch.Shuffle, and the fixed-length shuffle path indexes physical element 0 even though the const-null vector has no payload.
Expected Behavior
The query should return two NULL rows and must not panic.
Steps to Reproduce
DROPDATABASE IF EXISTS const_null_order_probe;
CREATEDATABASEconst_null_order_probe;
USE const_null_order_probe;
CREATETABLEt(a INT);
INSERT INTO t VALUES (1), (2);
SELECT INET_NTOA(NULL) AS empty_const_null FROM t ORDER BY a;
Additional information
Controls:
The same projection without ORDER BY returns two NULL rows.
Activity
fix: preserve varlena result cardinality for null rows (#26877)
Ariznawlll commentedon Aug 10, 2026
测试版本
main3c7392a0f86b23712da71f31d7a9198a2c8591a9原问题验证
按 issue 的两行
INET_NTOA(NULL)+ORDER BY复现 SQL 连续执行 3 次,均返回两行 NULL;无 panic、断连或服务重启。Happy Path 覆盖
ORDER BY后仍保留两行 NULL。Unhappy Path 覆盖
白盒验证
不适用:本次按公开 SQL 黑盒验证,未使用 fault injection。
回归测试
已加入 motr PR #89 的
suites/14_issue_regression/t/issue_26871_26691_26431_order_apply_table_function.test(commita6a50dfcf7053027dab5e9117fde7bdd7b5cdefb)。测试证据
MOTR:上述用例及关联 5 个场景连续 3 轮,合计 15/15 成功、171 条断言成功。
测试结论
测试通过。
fix: preserve varlena result cardinality for null rows (matrixorigin#…
fix: preserve varlena result cardinality for null rows (matrixorigin#…
fix: preserve varlena result cardinality for null rows (matrixorigin#…