Repository navigation
Description
Can be reproduced ?
Yes
Steps:
Result is normal when matched values when ORDER BY and GROUP BY
mysql> SELECT sum(LO_REVENUE), LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' GROUP BY LO_ORDERDATE, P_BRAND;
+-----------------+--------------+-----------+
| sum(LO_REVENUE) | LO_ORDERDATE | P_BRAND |
+-----------------+--------------+-----------+
| 2694816 | 19920110 | MFGR#2239 |
| 4878239 | 19920101 | MFGR#2239 |
| 994264 | 19920102 | MFGR#2239 |
| 4816459 | 19920103 | MFGR#2239 |
+-----------------+--------------+-----------+
4 rows in set (0.07 sec)
Result is normal when no matched values without ORDER BY or GROUP BY
mysql> SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE';
Empty set (0.06 sec)
Instance Crashed when no matched value with GROUP BY clause
mysql> SELECT sum(LO_REVENUE), LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123' AND S_REGION = 'EUROPE' GROUP BY LO_ORDERDATE, P_BRAND;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Instance Crashed when no matched value with ORDER BY clause
mysql> SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE' ORDER BY LO_ORDERDATE, P_BRAND;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Expected behavior:
No value in query
Actual behavior:
Instance crashed
Environment:
- Version or commit-id (e.g. v0.1.0 or 8b23a93): v0.1.0
- Hardware parameters:
- OS type: CentOS 7
- Others:
Configuration file:
Additional context:
- Error message from client:
- Server log:
query:SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE' ORDER BY LO_ORDERDATE, P_BRAND
panic: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x1afe4de]
goroutine 15927 [running]:
matrixone/pkg/sql/colexec/mergeorder.(*Container).eval(0xc001d2bd60, 0xc00929a090, 0xbf3113, 0x21e82e0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:172 +0x3e
matrixone/pkg/sql/colexec/mergeorder.Call(0xc00929a090, 0x2133600, 0xc001d2bd40, 0x39821e0, 0xbfe2b3, 0x2352e20)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:53 +0xb5
matrixone/pkg/vm.Run(0xc001d2be00, 0x3, 0x4, 0xc00929a090, 0xc0023eaaa0, 0xc2954c, 0x2352e20)
/root/matrixone-main/pkg/vm/vm.go:35 +0x9b
matrixone/pkg/vm/pipeline.(*Pipeline).RunMerge.func1(0xc00929a090, 0xc0023eaf38)
/root/matrixone-main/pkg/vm/pipeline/pipeline.go:76 +0x65
panic(0x21fcda0, 0x33aaa20)
/usr/lib/golang/src/runtime/panic.go:965 +0x1b9
matrixone/pkg/sql/colexec/mergeorder.(*Container).eval(0xc001d2bd60, 0xc00929a090, 0xc00929a090, 0x0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:172 +0x3e
matrixone/pkg/sql/colexec/mergeorder.Call(0xc00929a090, 0x2133600, 0xc001d2bd40, 0x2133740, 0xc00c0aef90, 0x0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:53 +0xb5
matrixone/pkg/vm.Run(0xc001d2be00, 0x3, 0x4, 0xc00929a090, 0x0, 0x0, 0xc001ac76d8)
/root/matrixone-main/pkg/vm/vm.go:35 +0x9b
matrixone/pkg/vm/pipeline.(*Pipeline).RunMerge(0xc0023eaf38, 0xc00929a090, 0x2728700, 0x0, 0x0)
/root/matrixone-main/pkg/vm/pipeline/pipeline.go:85 +0xf7
matrixone/pkg/sql/compile.(*Scope).MergeRun(0xc002632480, 0x27287f8, 0xc00488e0e8, 0x0, 0x0)
/root/matrixone-main/pkg/sql/compile/scope.go:101 +0x2f8
matrixone/pkg/sql/compile.(*Exec).Run.func2(0xc0027bae80, 0xc00c35f690, 0xc002632480)
/root/matrixone-main/pkg/sql/compile/compile.go:141 +0x46
created by matrixone/pkg/sql/compile.(*Exec).Run
/root/matrixone-main/pkg/sql/compile/compile.go:140 +0xfc
- Other information:
Activity
[-]Instance crashed when there is no matched value in WHERE clause with ORDER BY or GROUP BY clause[/-][+]Instance crashed when no matched value in WHERE clause with ORDER BY or GROUP BY clause[/+]MOOS2021 commentedon Aug 19, 2021
This reproduced in 3fea8f5.
mysql> SELECT C_CITY, S_CITY, LO_ORDERDATE, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI0' OR C_CITY = 'UNITED KI7') AND (S_CITY = 'UNITED KI0' OR S_CITY = 'UNITED KI7') AND LO_ORDERDATE >= 19920101 AND LO_ORDERDATE <= 19971231 GROUP BY C_CITY, S_CITY, LO_ORDERDATE;
Empty set (4.67 sec)
mysql> SELECT C_CITY, S_CITY, LO_ORDERDATE, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI0' OR C_CITY = 'UNITED KI7') AND (S_CITY = 'UNITED KI0' OR S_CITY = 'UNITED KI7') AND LO_ORDERDATE >= 19920101 AND LO_ORDERDATE <= 19971231 GROUP BY C_CITY, S_CITY, LO_ORDERDATE ORDER BY LO_ORDERDATE asc, revenue desc;
ERROR 2013 (HY000): Lost connection to MySQL server during query
nnsgmsone commentedon Aug 20, 2021
@XuPeng-SH