Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed May 13, 2021
1 parent 68d0a25 commit c515328
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9344,4 +9344,14 @@ func (s *testIntegrationSuite) TestEnumIndex(c *C) {
testkit.Rows(
"OFJHCEKCQGT:MXI7P3[YO4N0DF=2XJWJ4Z9Z;HQ8TMUTZV8YLQAHWJ4BDZHR3A -30 <nil>",
"ZOHBSCRMZPOI`IVTSEZAIDAF7DS@1TT20AP9 -30 <nil>"))

// issue 24576
tk.MustExec("use test")
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t(col1 enum('a','b','c'), col2 enum('a','b','c'), col3 int, index idx(col1,col2));")
tk.MustExec("insert into t values(1,1,1),(2,2,2),(3,3,3);")
tk.MustQuery("select /*+ use_index(t,idx) */ col3 from t where col2 between 'b' and 'b' and col1 is not null;").Check(
testkit.Rows("2"))
tk.MustQuery("select /*+ use_index(t,idx) */ col3 from t where col2 = 'b' and col1 is not null;").Check(
testkit.Rows("2"))
}
2 changes: 1 addition & 1 deletion util/ranger/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func handleEnumFromBinOp(sc *stmtctx.StatementContext, ft *types.FieldType, val
tmpEnum := types.Enum{}
for i := range ft.Elems {
tmpEnum.Name = ft.Elems[i]
tmpEnum.Value = uint64(i)
tmpEnum.Value = uint64(i) + 1
d := types.NewMysqlEnumDatum(tmpEnum)
if v, err := d.CompareDatum(sc, &val); err == nil {
switch op {
Expand Down

0 comments on commit c515328

Please sign in to comment.