Skip to content
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

Fail to choose index join in when index has time column. #8244

Closed
winoros opened this issue Nov 9, 2018 · 0 comments · Fixed by #8471
Closed

Fail to choose index join in when index has time column. #8244

winoros opened this issue Nov 9, 2018 · 0 comments · Fixed by #8471
Assignees
Labels
sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@winoros
Copy link
Member

winoros commented Nov 9, 2018

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table t(a int, b datetime, index idx(a, b));
create table tt(a int, b datetime);
explain select /*+ TIDB_INLJ(tt) */ * from t join tt where t.a=tt.a and t.b=tt.b;
  1. What did you expect to see?

It chooses index join.

  1. What did you see instead?

Failed. In log:

[types:1292]invalid time format: '1'

part of error stack:
github.com/pingcap/tidb/types.parseDateTimeFromNum
	/Users/yiding/gocode/src/github.com/pingcap/tidb/types/time.go:1172
github.com/pingcap/tidb/types.ParseTimeFromNum
	/Users/yiding/gocode/src/github.com/pingcap/tidb/types/time.go:1297
github.com/pingcap/tidb/types.(*Datum).convertToMysqlTime
	/Users/yiding/gocode/src/github.com/pingcap/tidb/types/datum.go:992
github.com/pingcap/tidb/types.(*Datum).ConvertTo
	/Users/yiding/gocode/src/github.com/pingcap/tidb/types/datum.go:690
github.com/pingcap/tidb/util/ranger.convertPoint
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/ranger.go:93
github.com/pingcap/tidb/util/ranger.appendPoints2IndexRange
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/ranger.go:159
github.com/pingcap/tidb/util/ranger.appendPoints2Ranges
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/ranger.go:145
github.com/pingcap/tidb/util/ranger.buildCNFIndexRange
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/ranger.go:308
github.com/pingcap/tidb/util/ranger.detachCNFCondAndBuildRangeForIndex
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/detacher.go:165
github.com/pingcap/tidb/util/ranger.DetachCondAndBuildRangeForIndex
	/Users/yiding/gocode/src/github.com/pingcap/tidb/util/ranger/detacher.go:323
github.com/pingcap/tidb/planner/core.(*LogicalJoin).buildRangeForIndexJoin
	/Users/yiding/gocode/src/github.com/pingcap/tidb/planner/core/exhaust_physical_plans.go:545
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

master 6c242ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant