stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

bug: LOAD BIT DATA, the results are inconsistent

Open davidshiz opened this issue 1 year ago • 4 comments

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • [X] I confirm there is no existing issue for this

Describe the problem

After OUTFILE the BIT data, then LOAD the data, the results are inconsistent

mysql> CREATE TABLE `bit_test` (
    ->   `a` bit(7) DEFAULT NULL,
    ->   `b` bit(9) DEFAULT NULL
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO bit_test VALUES (B'000001',B'1101100');
Query OK, 1 row affected (0.01 sec)

mysql> select a+0,b+0 from bit_test;
+------+------+
| a+0  | b+0  |
+------+------+
|    1 |  108 |
+------+------+
1 row in set (0.00 sec)

mysql> select * into outfile '~/bit_test_tbl' from bit_test;
Query OK, 1 row affected (0.00 sec)

root@ub01:~# cat bit_test_tbl
1;108

mysql> LOAD DATA LOCAL infile '~/bit_test_tbl' into table bit_test fields terminated by ';';
Query OK, 1 row affected, 1 warning (0.10 sec)
Records: 1  Deleted: 0  Skipped: 0  Warnings: 1

mysql> select a+0,b+0 from bit_test;
+------+---------+
| a+0  | b+0     |
+------+---------+
|    1 |     108 |
|   49 | 3223608 |
+------+---------+
2 rows in set (0.00 sec)

Expected behavior

No response

How To Reproduce

CREATE TABLE `bit_test` (
  `a` bit(7) DEFAULT NULL,
  `b` bit(9) DEFAULT NULL
);
INSERT INTO bit_test VALUES (B'000001',B'1101100');
select * into outfile '~/bit_test_tbl' from bit_test;
LOAD DATA LOCAL infile '~/bit_test_tbl' into table bit_test fields terminated by ';'

Environment

root@ub01:~# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 67b5c2073
        Last commit time: Date:   Fri Jan 6 15:40:19 2023 +0800
        Build time: Date: Mon Jan  9 23:16:55 CST 2023
root@ub01:~# cat /etc/issue
Ubuntu 20.04.5 LTS \n \l

Are you interested in submitting a PR to solve the problem?

  • [ ] Yes, I will!

davidshiz avatar Jan 10 '23 11:01 davidshiz