[
https://issues.apache.org/jira/browse/SQOOP-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14265812#comment-14265812
]
Veena Basavaraj edited comment on SQOOP-1915 at 1/6/15 8:11 AM:
----------------------------------------------------------------
I added this test case and it works
{code}
@Test
public void testParseCSVString() {
String csv= "'hello, world','34',45";
String[] arr = parseCSVString(csv);
assertEquals(arr.length, 3);
assertEquals(arr[0], "'hello, world'");
assertEquals(arr[1], "'34'");
assertEquals(arr[2], "45");
}
{code}
can you provide a test case that did not work? [~gwenshap]
Also added another test in csvIDF
{code}
@Test
public void testInputAsCSVTextInObjectOutWithSingleColumn() {
String testData = "'hello, world'";
Schema schema = new Schema("test");
schema.addColumn(new Text("text"));
dataFormat.setSchema(schema);
dataFormat.setCSVTextData(testData);
Object[] out = dataFormat.getObjectData();
assertEquals("hello, world",out[0]);
}
{code}
was (Author: vybs):
I added this test case and it works
{code}
@Test
public void testParseCSVString() {
String csv= "'hello, world','34',45";
String[] arr = parseCSVString(csv);
assertEquals(arr.length, 3);
assertEquals(arr[0], "'hello, world'");
assertEquals(arr[1], "'34'");
assertEquals(arr[2], "45");
}
{code}
can you provide a test case that did not work? [~gwenshap]
> sqoop2: parseCSV in CSVIDF doesn't correctly parse strings with commas
> ----------------------------------------------------------------------
>
> Key: SQOOP-1915
> URL: https://issues.apache.org/jira/browse/SQOOP-1915
> Project: Sqoop
> Issue Type: Sub-task
> Reporter: Gwen Shapira
> Assignee: Veena Basavaraj
>
> When creating a CSVIDF with a schema containing a single field (string or
> binary), then using setText("\"hello, world\"") and then getObjectData(), I
> expect to get an array, containing a string with "hello, world".
> Actual result:
> org.apache.sqoop.common.SqoopException:
> CSV_INTERMEDIATE_DATA_FORMAT_0005:Wrong number of columns. - The data "hello,
> world" has the wrong number of fields.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)