tikv: float_str_to_int_string should not return error

Bug Report

TiDB with TiKV:

mysql> CREATE TABLE t1 (s VARCHAR(50));
Query OK, 0 rows affected (0.12 sec)

mysql> INSERT INTO t1 VALUES('99999999e1000');
Query OK, 1 row affected (0.02 sec)

mysql> SELECT * from t1 where s;
ERROR 1105 (HY000): Other(StringError("[src/coprocessor/codec/convert.rs:321]: [1264] Data Out of Range"))

TiDB without TiKV:

mysql> CREATE TABLE t1 (s VARCHAR(50));
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO t1 VALUES('99999999e1000');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * from t1 where s;
+---------------+
| s             |
+---------------+
| 99999999e1000 |
+---------------+
1 row in set, 1 warning (0.00 sec)

MySQL:

mysql> CREATE TABLE t1 (s VARCHAR(50));
Query OK, 0 rows affected (0.16 sec)

mysql> INSERT INTO t1 VALUES('99999999e1000');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * from t1 where s;
+---------------+
| s             |
+---------------+
| 99999999e1000 |
+---------------+
1 row in set, 1 warning (0.00 sec)

According to TiDB’s implementation of float_str_to_int_string it returns warnings instead of errors. That should be the main reason why this fails in TiKV.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (16 by maintainers)

Most upvoted comments

Yes! Thanks a lot!

@liufuyang Or you may just use tidb-ansible from https://github.com/pingcap/tidb-ansible, but subsitute the tikv binary in resources/bin from the one downloaded by ansible to yours.

@liufuyang Should be do-able that way. You’d set up the docker-compose and make TiKV work “from source” via the instructions here I think: https://github.com/pingcap/tidb-docker-compose#bring-up-tidb-cluster

@liufuyang You can grep for “append_warning” and you will see that normally there will be a ctx.warnings.append_warning. So to append warnings the function should accept that ctx first (and you need to change the signature)