Skip to content

Commit

Permalink
FIX error parsing of not in express
Browse files Browse the repository at this point in the history
  • Loading branch information
wangfei committed Mar 26, 2017
1 parent 7dbc0fa commit 46812f3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions proxy/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,23 +353,25 @@ func checkPlan(t *testing.T, sql string, tableIndexs []int, nodeIndexs []int) {
}
func TestWhereInPartitionByTableIndex(t *testing.T) {
var sql string
t1 := makeList(0, 12)

//2016-08-02 13:37:26
sql = "select * from test1 where id in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22) "
checkPlan(t, sql,
[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
t1,
[]int{0, 1, 2},
)
// ensure no impact for or operator in where
sql = "select * from test1 where id in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21) or name='test'"
checkPlan(t, sql,
[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
t1,
[]int{0, 1, 2},
)

// ensure no impact for not in
sql = "select * from test1 where id not in (0,1,2,3,4,5,6,7)"
checkPlan(t, sql,
[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
t1,
[]int{0, 1, 2})

}
Expand Down Expand Up @@ -471,7 +473,7 @@ func TestSelectPlan(t *testing.T) {
checkPlan(t, sql, t1, []int{0, 1, 2})

sql = "select * from test1 where id not in (5, 6)"
checkPlan(t, sql, []int{0, 1, 2, 3, 4, 7, 8, 9, 10, 11}, []int{0, 1, 2})
checkPlan(t, sql, t1, []int{0, 1, 2})

sql = "select * from test1 where id in (5, 6) or (id in (5, 6, 7,8) and id in (1,5,7))"
checkPlan(t, sql, []int{5, 6, 7}, []int{1})
Expand Down

0 comments on commit 46812f3

Please sign in to comment.