Open davidshiz opened 1 year ago
related to this #1161
ACK.
When bit63
used as where condition, the result is empty.
mysql> create table bit63(a bit(63)) engine=tianmu;
Query OK, 0 rows affected (0.01 sec)
mysql> insert into bit63 values(b'111111111111111111111111111111111111111111111111111111111111111');
Query OK, 1 row affected (0.00 sec)
mysql> insert into bit63 values(b'11111111111111111111111111111111111111111111111111111111111111');
Query OK, 1 row affected (0.00 sec)
mysql> insert into bit63 values(b'1111');
Query OK, 1 row affected (0.00 sec)
mysql> select a+0 from bit63;
+---------------------+
| a+0 |
+---------------------+
| 9223372036854775807 |
| 15 |
| 4611686018427387903 |
+---------------------+
3 rows in set (0.00 sec)
mysql> select hex(a) from bit63;
+------------------+
| hex(a) |
+------------------+
| 7FFFFFFFFFFFFFFF |
| F |
| 3FFFFFFFFFFFFFFF |
+------------------+
3 rows in set (0.00 sec)
mysql> select hex(a) from bit63 where a=b'1111';
+--------+
| hex(a) |
+--------+
| F |
+--------+
1 row in set (0.00 sec)
mysql> SELECT HEX(a) FROM bit63 WHERE a = b'111111111111111111111111111111111111111111111111111111111111111';
Empty set (0.00 sec)
mysql> SELECT HEX(a) FROM bit63 WHERE a = b'11111111111111111111111111111111111111111111111111111111111111';
+------------------+
| HEX(a) |
+------------------+
| 3FFFFFFFFFFFFFFF |
+------------------+
1 row in set (0.00 sec)
explain for bit63:
mysql> explain SELECT HEX(a) FROM bit63 WHERE a = b'111111111111111111111111111111111111111111111111111111111111111';
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------------------------------------------------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------------------------------------------------------------------------------------------+
| 1 | SIMPLE | bit63 | NULL | ALL | NULL | NULL | NULL | NULL | 3 | 33.33 | Using where with pushed condition (`test`.`bit63`.`a` = 0x7fffffffffffffff)(t0) Pckrows: 1, susp. 0 (1 empty 0 full). Conditions: 1 |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
It seems a magic number for bit63
(7FFFFFFFFFFFFFFF), I expand bit M = 64, bit64
(FFFFFFFFFFFFFFFF) is ok in this case,bit(M), M between 1~62 are all OK.
I need deeper debug to find what happened in where filter.
Have you read the Contributing Guidelines on issues?
Please confirm if bug report does NOT exists already ?
Describe the problem
Expected behavior
How To Reproduce
Environment
Are you interested in submitting a PR to solve the problem?