tidb icon indicating copy to clipboard operation
tidb copied to clipboard

slice bounds out of range

Open bajinsheng opened this issue 6 months ago • 3 comments

Bug Report

1. Minimal reproduce step (Required)

select distinct avg(nullif(77.15, PI())); --runtime error: slice bounds out of range [:1] with capacity 0

2. What did you expect to see? (Required)

No error

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

tiup playground nightly --host 0.0.0.0 --kv 3 --tiflash 3

8.0.11-TiDB-v9.0.0-beta.1.pre-554-gb1a5536a64-dirty

bajinsheng avatar Jun 13 '25 18:06 bajinsheng

/label fuzz/sqlancer

bajinsheng avatar Jun 13 '25 18:06 bajinsheng

If we return buf, err in line 1520, we can get the result with warning. https://github.com/pingcap/tidb/blob/6a12f31171dda2ef20ad4f81f6b2cd95bf13feab/pkg/util/codec/codec.go#L1511-L1523

Image

joechenrh avatar Jun 17 '25 09:06 joechenrh

Since https://github.com/pingcap/tidb/pull/48613, https://github.com/pingcap/tidb/blob/v8.5.2/pkg/executor/aggregate/agg_util.go#L149-L150

The codec.HashGroupKey return error and errCtx.HandleError set it to nil.

solotzg avatar Jun 17 '25 09:06 solotzg

@YangKeao PTAL

solotzg avatar Jun 19 '25 08:06 solotzg