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
Please answer these questions before submitting your issue. Thanks!
What did you do?
Add these test lines into TestShowStatsHistograms:
diff --git a/executor/show_stats_test.go b/executor/show_stats_test.go
index 05987b5..81e1771 100644
--- a/executor/show_stats_test.go
+++ b/executor/show_stats_test.go
@@ -47,6 +47,15 @@ func (s *testSuite1) TestShowStatsHistograms(c *C) {
result = tk.MustQuery("show stats_histograms where column_name = 'a'")
c.Assert(len(result.Rows()), Equals, 1)
c.Assert(result.Rows()[0][3], Equals, "a")
+
+ tk.MustExec("drop table t")
+ tk.MustExec("create table t(a int, b int, c int, index idx_b(b), index idx_c_a(c, a))")
+ tk.MustExec("insert into t values(1,null,1),(2,null,2),(3,3,3),(4,null,4),(null,null,null)")
+ res := tk.MustQuery("show stats_histograms where table_name = 't'")
+ c.Assert(len(res.Rows()), Equals, 0)
+ tk.MustExec("analyze table t index idx_b")
+ res = tk.MustQuery("show stats_histograms where table_name = 't' and column_name = 'idx_b'")
+ c.Assert(len(res.Rows()), Equals, 1)
}
then run go test under executor package.
What did you expect to see?
Test result should be either OK or FAIL, not PANIC.
What did you see instead?
----------------------------------------------------------------------
PANIC: show_stats_test.go:37: testSuite1.TestShowStatsHistograms
... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0xB8581A)
/usr/local/go/src/runtime/panic.go:513
in gopanic
/usr/local/go/src/runtime/panic.go:82
in panicmem
/usr/local/go/src/runtime/signal_unix.go:390
in sigpanic
/root/go/src/github.com/pingcap/tidb/statistics/histogram.go:112
in Column.AvgColSize
show_stats.go:85
in ShowExec.appendTableForStatsHistograms
show_stats.go:69
in ShowExec.fetchShowStatsHistogram
show.go:147
in ShowExec.fetchAll
show.go:74
in ShowExec.Next
executor.go:928
in SelectionExec.Next
adapter.go:104
in recordSet.Next
/root/go/src/github.com/pingcap/tidb/session/tidb.go:264
in GetRows4Test
/root/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:211
in TestKit.ResultSetToResult
/root/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:185
in TestKit.MustQuery
show_stats_test.go:57
in testSuite1.TestShowStatsHistograms
/usr/local/go/src/reflect/value.go:308
in Value.Call
/root/go/pkg/mod/github.com/pingcap/[email protected]/check.go:836
in suiteRunner.forkTest.func1
/root/go/pkg/mod/github.com/pingcap/[email protected]/check.go:730
in suiteRunner.forkCall.func1
/usr/local/go/src/runtime/asm_amd64.s:1333
in goexit
What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v3.0.0-beta-124-g511a80b-dirty
Git Commit Hash: 511a80bae4d37b65b7f9e41e23f700c9b4c79584
Git Branch: master
UTC Build Time: 2019-02-23 11:33:57
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
The text was updated successfully, but these errors were encountered:
Bug Report
Please answer these questions before submitting your issue. Thanks!
Add these test lines into
TestShowStatsHistograms
:then run
go test
underexecutor
package.Test result should be either OK or FAIL, not PANIC.
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: