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

planner: use the converted datum based on the target column to point get #26713

Merged
merged 16 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions util/ranger/ranger.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func convertPoint(sc *stmtctx.StatementContext, point *point, tp *types.FieldTyp
if valCmpCasted == 0 {
return npoint, nil
}
isSameType := tp.Tp == point.value.Kind()
if isSameType {
return npoint, nil
}
if npoint.start {
if npoint.excl {
if valCmpCasted < 0 {
Expand Down
29 changes: 28 additions & 1 deletion util/ranger/ranger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ func (s *testRangerSuite) TestColumnRange(c *C) {
exprStr: `c > 111.11111111`,
accessConds: "[gt(test.t.c, 111.11111111)]",
filterConds: "[]",
resultStr: "[[111.111115,+inf]]",
resultStr: "[(111.111115,+inf]]",
length: types.UnspecifiedLength,
},
{
Expand Down Expand Up @@ -1254,6 +1254,33 @@ func (s *testRangerSuite) TestIndexRangeElimininatedProjection(c *C) {
))
}

func (s *testRangerSuite) TestIssue26638(c *C) {
defer testleak.AfterTest(c)()
dom, store, err := newDomainStoreWithBootstrap(c)
defer func() {
dom.Close()
store.Close()
}()
c.Assert(err, IsNil)
testKit := testkit.NewTestKit(c, store)
testKit.MustExec("use test")
testKit.MustExec("drop table if exists t")
testKit.MustExec("create table t(a float, unique index uidx(a));")
testKit.MustExec("insert into t values(9.46347e37);")
testKit.MustExec("analyze table t")
testKit.MustQuery("explain format = 'brief' select * from t where a in (-1.56018e38, -1.96716e38, 9.46347e37);").Check(testkit.Rows(
"Batch_Point_Get 1.00 root table:t, index:uidx(a) keep order:false, desc:false",
))
testKit.MustQuery("select * from t where a in (-1.56018e38, -1.96716e38, 9.46347e37);").Check(testkit.Rows(
"94634700000000000000000000000000000000",
))
testKit.MustExec("prepare stmt from 'select * from t where a in (?, ?, ?);';")
testKit.MustExec("set @a=-1.56018e38, @b=-1.96716e38, @c=9.46347e37;")
testKit.MustQuery("execute stmt using @a, @b, @c;").Check(testkit.Rows(
"94634700000000000000000000000000000000",
))
}

func (s *testRangerSuite) TestCompIndexInExprCorrCol(c *C) {
defer testleak.AfterTest(c)()
dom, store, err := newDomainStoreWithBootstrap(c)
Expand Down