pingcap / pingcap/tidb

[stats] error occurred when read table stats:DOUBLE value is out of range in '' & Incorrect time value: '{0 0 0 0 0 0 0}'

Open
#42,964 2 comments 0 reactions 0 assignees View on GitHub
severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
2023-04-12 11:12:02 (UTC+08:00)TiDB x.x.x.x:4000[terror.go:315] ["encountered error"] [error="[types:1292]Incorrect time value: '{0 0 0 0 0 0 0}'"] [stack="github.com/pingcap/tidb/parser/terror.Log\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:315\ngithub.com/pingcap/tidb/types.(*Time).Sub\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/types/time.go:705\ngithub.com/pingcap/tidb/statistics.convertDatumToScalar\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/scalar.go:77\ngithub.com/pingcap/tidb/statistics.(*Histogram).PreCalculateScalar\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/scalar.go:108\ngithub.com/pingcap/tidb/statistics/handle.(*Handle).histogramFromStorage\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:1972\ngithub.com/pingcap/tidb/statistics/handle.(*Handle).columnStatsFromStorage\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:1367\ngithub.com/pingcap/tidb/statistics/handle.(*Handle).TableStatsFromStorage\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:1471\ngithub.com/pingcap/tidb/statistics/handle.(*Handle).Update\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:620\ngithub.com/pingcap/tidb/domain.(*Domain).loadStatsWorker\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/domain/domain.go:1895\ngithub.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/wait_group_wrapper.go:33"]

2023-04-12 11:12:02 (UTC+08:00)TiDB x.x.x.x:4000[handle.go:623] ["[stats] error occurred when read table stats"] [table=log_api_2304] [error="[types:1690]DOUBLE value is out of range in ''"]
```

```
CREATE TABLE `log_api_2304` (
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '日志流水号',
`log_userid` int(11) NOT NULL DEFAULT '0' COMMENT '日志人',
`log_username` varchar(32) COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志用户',
`log_api` varchar(32) COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '接口类型',
`log_request` varchar(4000) COLLATE utf8_general_ci NOT NULL COMMENT '发送的数据',
`log_request_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发送的时间',
`log_response` varchar(4000) COLLATE utf8_general_ci NOT NULL COMMENT '返回的数据',
`log_response_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '返回的时间',
`log_cost_time` float(10,6) DEFAULT NULL COMMENT 'API往返花费的时间',
`log_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '类型',
PRIMARY KEY (`log_id`) /*T![clustered_index] CLUSTERED */,
KEY `idx_request_time_uname` (`log_request_time`,`log_username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=270002 COMMENT='API发送日志(每月一份)';
```

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

### 3. What did you see instead (Required)

### 4. What is your TiDB version? (Required)

```
Release Version: v6.5.1
Edition: Community
Git Commit Hash: 4084b077d615f9dc0a41cf2e30bc6e1a02332df2
Git Branch: heads/refs/tags/v6.5.1
UTC Build Time: 2023-03-07 16:12:08
GoVersion: go1.19.5
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.