You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by Harmeet Singh <ha...@knoldus.com> on 2016/10/26 05:06:28 UTC

In load data, CSV row contains special char at start and end of value but insert as a NULL

Hey Team,

I am trying to load the data in CSV with special char. But if some rows
contains some special char at start and end, the whole value is ignore and
inserted Null value. I am expecting this values insert as a string if the
start and end char are not match with quote char. Following are the details: 

*CSV file:* 

name, description, salary, age, dob
tammy,$my name$,$900000$,22,19/10/2019
tammy1,$delhi$,$32345$,22,19/10/2019
tammy2,$banglore$,$543$,%22%,19/10/2019

*Create Table: *

create table one (name string, description string, salary double, age int,
dob timestamp) stored by 'carbondata';

*load data: *

load data local inpath
'hdfs://localhost:54310/home/harmeet/dollarquote1.csv' into table one
OPTIONS('QUOTECHAR'="$");

*Actual Results*: 

+---------+--------------+-------+-----------+-------+--+
|  name   | description  |  dob  |  salary   |  age  |
+---------+--------------+-------+-----------+-------+--+
| tammy   | my name      | NULL  | 900000.0  | 22    |
| tammy1  | delhi        | NULL  | 32345.0   | 22    |
| tammy2  | banglore     | NULL  | 543.0     | NULL  |
+---------+--------------+-------+-----------+-------+--+
5 rows selected (0.247 seconds)

*Expected Results: *

+---------+--------------+-------+-----------+-------+--+
|  name   | description  |  dob  |  salary   |  age  |
+---------+--------------+-------+-----------+-------+--+
| tammy   | my name      | NULL  | 900000.0  | 22    |
| tammy1  | delhi        | NULL  | 32345.0   | 22    |
| tammy2  | banglore     | NULL  | 543.0     | %22%  |
+---------+--------------+-------+-----------+-------+--+





--
View this message in context: http://apache-carbondata-mailing-list-archive.1130556.n5.nabble.com/In-load-data-CSV-row-contains-special-char-at-start-and-end-of-value-but-insert-as-a-NULL-tp2345.html
Sent from the Apache CarbonData Mailing List archive mailing list archive at Nabble.com.

Re: In load data, CSV row contains special char at start and end of value but insert as a NULL

Posted by Harmeet Singh <ha...@knoldus.com>.
Thanks Ravi, This is working fine. 



--
View this message in context: http://apache-carbondata-mailing-list-archive.1130556.n5.nabble.com/In-load-data-CSV-row-contains-special-char-at-start-and-end-of-value-but-insert-as-a-NULL-tp2345p2348.html
Sent from the Apache CarbonData Mailing List archive mailing list archive at Nabble.com.

Re: In load data, CSV row contains special char at start and end of value but insert as a NULL

Posted by ravipesala <ra...@gmail.com>.
Here age is int data type so it cannot insert special characters. Please try
with string type and verify.



--
View this message in context: http://apache-carbondata-mailing-list-archive.1130556.n5.nabble.com/In-load-data-CSV-row-contains-special-char-at-start-and-end-of-value-but-insert-as-a-NULL-tp2345p2346.html
Sent from the Apache CarbonData Mailing List archive mailing list archive at Nabble.com.