Details
-
Technical task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(10), KEY(c(1))) ENGINE=LevelDB; |
INSERT INTO t1 VALUES (40,'october'),(41,'february'); |
SELECT * FROM t1 WHERE c NOT IN ('l', 'f', 'w'); |
Actual result:
+----+---------+
|
| pk | c |
|
+----+---------+
|
| 40 | october |
|
+----+---------+
|
Expected result:
+----+----------+
|
| pk | c |
|
+----+----------+
|
| 41 | february |
|
| 40 | october |
|
+----+----------+
|
EXPLAIN:
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
|
| 1 | SIMPLE | t1 | range | c | c | 2 | NULL | 30 | 100.00 | Using where |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
|
revision-id: psergey@askmonty.org-20130319110939-z2fi30aslmhwxslk
|
revno: 4611
|
branch-nick: mysql-5.6-leveldb
|
List of ranges to be scanned (it is surprising that 'w' is not in the list of endpoints, but that itself is not a bug):
"ranges": [
"NULL < c < f",
"f < c < l", — 'february' record falls here
"l < c" — 'october' record falls here
]
The following happens:
...
> ha_leveldb->index_read_map(key='F', find_flag=HA_READ_AFTER_KEY)
get an index record with rkey='F'.
We figure that rkey=key , and since flag=HA_READ_AFTER_KEY, we should step one record forward.
However, HA_READ_AFTER_KEY in the parameter refers to the whole lookup tuple, not to the prefix that's stored in the index.