[MCOL-1226] cpimport fills last date column with '0000-00-00 00:00:00' instead of null Created: 2018-02-21  Updated: 2018-05-18  Resolved: 2018-05-18

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

Type: Bug Priority: Major
Reporter: Dalu (Inactive) Assignee: Andrew Hutchings (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

Debian 9 / Ubuntu 16



 Description   

When importing a csv file via cpimport and the last column is a date column containing no/null values in the csv file, cpimport writes '0000-00-00 00:00:00' into that fields instead of null/nothing



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2018-02-21 ]

If I am understanding correctly you have a CSV file with NULL values in a DATETIME column and are saying that it writes out '0000-00-00 00:00:00'. If this is the case can you please try using the option '-n1' with cpimport? This tells it that NULL is the value NULL not the word NULL.

Comment by Dalu (Inactive) [ 2018-02-21 ]

Example:

CREATE TABLE `testtable` (,
`Date1` datetime DEFAULT NULL,
`Date2` datetime DEFAULT NULL,
`Date3` datetime DEFAULT NULL
) ENGINE=Columnstore;

I import a csv file via cpimport:
, , (3 empty columns)

and cpimport writes into table:
null, null, '0000-00-00 00:00:00'

as I said this happens only to/if the last column of the table is a date/datetime column.

CREATE TABLE `testtable` (,
`Date1` datetime DEFAULT NULL,
`Date2` datetime DEFAULT NULL,
`Date3` datetime DEFAULT NULL
`Col4` int DEFAULT NULL
) ENGINE=Columnstore;

With this scenario everything works correctly, since Date3 is not the last column of the table.

Comment by Andrew Hutchings (Inactive) [ 2018-02-21 ]

With a file containing 3 empty columns I get:

MariaDB [test]> select * from testtable;
+-------+-------+-------+
| Date1 | Date2 | Date3 |
+-------+-------+-------+
| NULL  | NULL  | NULL  |
+-------+-------+-------+
1 row in set (0.18 sec)

Can you please let us know what cpimport options you are using?

Comment by Dalu (Inactive) [ 2018-02-21 ]

okay I missed one point, one of the entries need to have a none null value for the last column. try the following csv:

,,
,,2018-02-21 00:00:00.000

the last column of the first entry will get filled with 0000-00-00 00:00:00

  1. Date1, Date2, Date3
    , , 0000-00-00 00:00:00
    , , 2018-02-21 00:00:00

my cpimport options are
/usr/local/mariadb/columnstore/bin/cpimport <db> <table> <csvpath> -s "\t" (I use tab for delimeter)

Comment by Dalu (Inactive) [ 2018-03-13 ]

Was it possible to reproduce this behavior?

Comment by Andrew Hutchings (Inactive) [ 2018-03-13 ]

Unfortunately not, here is what I am doing, please let me know where I'm going wrong:

Table:

CREATE TABLE `testtable` (
  `Date1` datetime DEFAULT NULL,
  `Date2` datetime DEFAULT NULL,
  `Date3` datetime DEFAULT NULL
) ENGINE=Columnstore

CSV file (tab delimited CSV data):

		
		2018-02-21 00:00:00.000

cpimport command:

cpimport test testtable mcol-1226.csv -s "\t"

Resulting database data:

MariaDB [test]> select * from testtable;
+-------+-------+---------------------+
| Date1 | Date2 | Date3               |
+-------+-------+---------------------+
| NULL  | NULL  | NULL                |
| NULL  | NULL  | 2018-02-21 00:00:00 |
+-------+-------+---------------------+
2 rows in set (0.20 sec)

Comment by Dalu (Inactive) [ 2018-05-18 ]

with current version this behavior didnt happen anymore - issue can be closed

Comment by Andrew Hutchings (Inactive) [ 2018-05-18 ]

Closing upon request

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