[MCOL-1786] Handle "true" keyword for numeric data types in cpimport Created: 2018-10-10  Updated: 2018-11-21  Resolved: 2018-11-13

Status: Closed
Project: MariaDB ColumnStore
Component/s: cpimport
Affects Version/s: 1.2.0
Fix Version/s: 1.2.1

Type: Bug Priority: Minor
Reporter: Gagan Goel (Inactive) Assignee: Zdravelina Sokolovska (Inactive)
Resolution: Fixed Votes: 0
Labels: contribution, relnote

Issue Links:
Relates
relates to MCOL-1879 csv text "true" is mapped to 0 during... Closed
Sprint: 2018-20

 Description   

I noticed that the cpimport utility currently does not handle "true" keyword. Inserting rows into a table with numeric columns assigned "true" values via the mariadb client works fine, but cpimport is converting these to 0 when imported via a text file.

Here is an example:

MariaDB [mcs]> create table t7 (a boolean, b tinyint, c smallint, d int, e bigint, f float, g double, h decimal(10, 3))engine=columnstore;
Query OK, 0 rows affected (0.241 sec)
 
MariaDB [mcs]> insert into t7 values (false, false, false, false, false, false, false, false), (true, true, true, true, true, true, true, true);
Query OK, 2 rows affected (0.281 sec)
Records: 2  Duplicates: 0  Warnings: 0
 
MariaDB [mcs]> select * from t7;
+------+------+------+------+------+------+------+-------+
| a    | b    | c    | d    | e    | f    | g    | h     |
+------+------+------+------+------+------+------+-------+
|    0 |    0 |    0 |    0 |    0 |    0 |    0 | 0.000 |
|    1 |    1 |    1 |    1 |    1 |    1 |    1 | 1.000 |
+------+------+------+------+------+------+------+-------+
2 rows in set (0.143 sec)

Now inserting 2 records from a text file into this table using cpimport:

tntnatbry:bin$ cat data.txt
false|false|false|false|false|false|false|false
true|true|true|true|true|true|true|true
 
tntnatbry:bin$ sudo ./cpimport.bin mcs t7 ./data.txt

The new contents of the table:

MariaDB [mcs]> select * from t7;
+------+------+------+------+------+------+------+-------+
| a    | b    | c    | d    | e    | f    | g    | h     |
+------+------+------+------+------+------+------+-------+
|    0 |    0 |    0 |    0 |    0 |    0 |    0 | 0.000 |
|    1 |    1 |    1 |    1 |    1 |    1 |    1 | 1.000 |
|    0 |    0 |    0 |    0 |    0 |    0 |    0 | 0.000 |
|    0 |    0 |    0 |    0 |    0 |    0 |    0 | 0.000 |
+------+------+------+------+------+------+------+-------+
4 rows in set (0.096 sec)

I am assuming this is not intended behaviour.



 Comments   
Comment by Gagan Goel (Inactive) [ 2018-10-10 ]

PR 591 fixes this.

Comment by Zdravelina Sokolovska (Inactive) [ 2018-11-13 ]

t7.csv:
false|false|false|false|false|false|false|false
true|true|true|true|true|true|true|true

[root@um1 ~]# cpimport tt t7 t7.csv
2018-11-13 16:17:34 (13838) INFO : Running distributed import (mode 1) on all PMs...
2018-11-13 16:17:35 (13838) INFO : For table tt.t7: 2 rows processed and 2 rows inserted.
2018-11-13 16:17:35 (13838) INFO : Bulk load completed, total run time : 1.02068 seconds
[root@um1 ~]# mcsmysql -u root -p1
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 133178
Server version: 10.3.10-MariaDB-log Columnstore 1.2.1-1

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select * from tt.t7 ;
-----------------------------------+

a b c d e f g h

-----------------------------------+

0 0 0 0 0 0 0 0.000
1 1 1 1 1 1 1 1.000
0 0 0 0 0 0 0 0.000
1 1 1 1 1 1 1 1.000
0 0 0 0 0 0 0 0.000
1 1 1 1 1 1 1 1.000

-----------------------------------+
6 rows in set, 1 warning (0.118 sec)

MariaDB [(none)]>

Generated at Thu Feb 08 02:31:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.