[MCOL-844] cpimport tool bug wtih decimal table Created: 2017-07-31  Updated: 2017-11-27  Resolved: 2017-11-27

Status: Closed
Project: MariaDB ColumnStore
Component/s: cpimport
Affects Version/s: 1.0.9
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: jerry ma Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

centos6.8


Attachments: PNG File 1.png     Microsoft Word test.csv    

 Description   

I have a column defined as decimal(7,2), when using cpimport I see the following behavior when importing values to this column. ( csv files )
CREATE TABLE `test_dec` (
`id` int(11) DEFAULT NULL,
`a` decimal(7,2) DEFAULT NULL
) ENGINE=columnstore DEFAULT CHARSET=latin1 |

When importing 23.45, the resulting value is 23.45.
When import 23.5, the resulting value is 2.35, should be 23.50

cpimport is shifting the decimal place if the source file value does not contain 2 decimal places.

by the way,when we change column a before column id, the cpimport result is correct!



 Comments   
Comment by David Thompson (Inactive) [ 2017-07-31 ]

Not able to reproduce (i tested in 1.0.10 but not aware of any related code changes). I used your table definition and this import file:
1|23.45
2|23.5
3|21.2

MariaDB [test]> select * from test_dec;
-----------+

id a

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

1 23.45
2 23.50
3 21.20

-----------+
3 rows in set (0.02 sec)

Can you check that and provide me a simplified data file that repros plus how you ran cpimport exactly?

Comment by jerry ma [ 2017-08-01 ]

Hi,please try this table and csv files. thanks

CREATE TABLE `test` (
`gjtkopfxem_7` bigint(20) DEFAULT '0',
`gongneng1` varchar(512) DEFAULT NULL,
`wkzvkslotk_1` datetime DEFAULT NULL,
`vzvxilozhu_2` decimal(18,15) DEFAULT '0.000000000000000'
) ENGINE=Columnstore DEFAULT CHARSET=utf8

test.csv

Comment by David Thompson (Inactive) [ 2017-08-01 ]

try removing windows line endings from the file. After i did that (using dos2unix command for example) the numbers seem to load correctly.

Comment by jerry ma [ 2017-08-03 ]

if I change `vzvxilozhu_2` before the varchar column or I delete the varchar column ,it's ok.
and the code which product the csv file does't contain Suspicious symbol.

Comment by David Thompson (Inactive) [ 2017-08-09 ]

Right because that's going to change how it's parsed. Can you confirm if you tried using unix line endings (\n) on the csv file rather than windows? From what i could see that was the main problem.

Comment by David Thompson (Inactive) [ 2017-11-27 ]

cpimport requires unix line endings for the import files

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