-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hashAgg panic when UpdatePartialResult #40470
Comments
Can't reproduce it, But it is really a problem that can happen. |
Maybe it is related to chunks that come from tikv were broken. But I can't find any evidence. |
CREATE TABLE `51f733a0-38f8-43c0-9d8f-65cb595de6cb` (
`0c847db1-c6fe-4a0a-b94b-7b1db90baecf` set('2','b3y6i','m','tl4y','rr76e','tto','c39i','k4','0','s','t9') NOT NULL DEFAULT 'tl4y,k4',
`3faa4ffc-299d-45c8-ad29-6193149a2a67` int(11) NOT NULL DEFAULT '-1622310057',
PRIMARY KEY (`0c847db1-c6fe-4a0a-b94b-7b1db90baecf`,`3faa4ffc-299d-45c8-ad29-6193149a2a67`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci COMMENT='a5e6239a-44f1-472e-8fa2-7be46d9bff47'
PARTITION BY HASH (`3faa4ffc-299d-45c8-ad29-6193149a2a67`) PARTITIONS 10;
INSERT INTO `51f733a0-38f8-43c0-9d8f-65cb595de6cb` VALUES ('tto',-1369524874),('s',609852990),('tl4y',-1533124452),('tto',-912893072),('0',1695262582),('tto',1190930211),('b3y6i',-2054779085),('b3y6i',-1744747545),('tto',-882858939);
/*!40000 ALTER TABLE `51f733a0-38f8-43c0-9d8f-65cb595de6cb` ENABLE KEYS */;
select `51f733a0-38f8-43c0-9d8f-65cb595de6cb`.`0c847db1-c6fe-4a0a-b94b-7b1db90baecf` as r0 , avg( distinct `51f733a0-38f8-43c0-9d8f-65cb595de6cb`.`3faa4ffc-299d-45c8-ad29-6193149a2a67` ) as r1 from `51f733a0-38f8-43c0-9d8f-65cb595de6cb` group by `51f733a0-38f8-43c0-9d8f-65cb595de6cb`.`0c847db1-c6fe-4a0a-b94b-7b1db90baecf` order by r0,r1 ; |
CREATE TABLE t (
c1 set('2','b3y6i','m','tl4y','rr76e','tto','c39i','k4','0','s','t9'),
c2 int,
PRIMARY KEY (c1, c2)
)
PARTITION BY HASH (c2) PARTITIONS 2;
INSERT INTO t VALUES ('tto',-1369524874),('s',609852990),('tl4y',-1533124452),('tto',-912893072),('0',1695262582),('tto',1190930211),('b3y6i',-2054779085),('b3y6i',-1744747545);
select t.c1 as r0 , avg( distinct t.c2 ) as r1 from t group by t.c1; Minimal sql to reproduce the bug. |
/component tablepartition |
Whatever, the 8.1 can get correct result with dynamic pruning is really really set by default whatever stats exists or not. |
We keep it open unless the static pruning is totally removed, but tidb starting from 8.1 will not panic by default. Starting from v8.1, you need to |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
No error
3. What did you see instead (Required)
[err="runtime error: index out of range [0] with length 0\ngithub.com/pingcap/tidb/executor.recoveryProjection\n\t/Users/bba/pc/tidb/executor/projection.go:460\ngithub.com/pingcap/tidb/executor.(*projectionInputFetcher).run.func1\n\t/Users/bba/pc/tidb/executor/projection.go:360\nruntime.gopanic\n\t/Users/bba/.gvm/gos/go1.19/src/runtime/panic.go:884\nruntime.goPanicIndex\n\t/Users/bba/.gvm/gos/go1.19/src/runtime/panic.go:113\ngithub.com/pingcap/tidb/util/chunk.(*Column).IsNull\n\t/Users/bba/pc/tidb/util/chunk/column.go:169\ngithub.com/pingcap/tidb/util/chunk.Row.IsNull\n\t/Users/bba/pc/tidb/util/chunk/row.go:218\ngithub.com/pingcap/tidb/expression.(*Column).EvalReal\n\t/Users/bba/pc/tidb/expression/column.go:428\ngithub.com/pingcap/tidb/executor/aggfuncs.(*firstRow4Float32).UpdatePartialResult\n\t/Users/bba/pc/tidb/executor/aggfuncs/func_first_row.go:185\ngithub.com/pingcap/tidb/executor.(*HashAggExec).execute\n\t/Users/bba/pc/tidb/executor/aggregate.go:1044\ngithub.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec\n\t/Users/bba/pc/tidb/executor/aggregate.go:966\ngithub.com/pingcap/tidb/executor.(*HashAggExec).Next\n\t/Users/bba/pc/tidb/executor/aggregate.go:785\ngithub.com/pingcap/tidb/executor.Next\n\t/Users/bba/pc/tidb/executor/executor.go:328\ngithub.com/pingcap/tidb/executor.(*projectionInputFetcher).run\n\t/Users/bba/pc/tidb/executor/projection.go:384\nruntime.goexit\n\t/Users/bba/.gvm/gos/go1.19/src/runtime/asm_arm64.s:1165"]
If remove the index merge hint, we got:
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: