Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/566#discussion_r29143622
  
    --- Diff: 
flink-java/src/test/java/org/apache/flink/api/java/io/CsvInputFormatTest.java 
---
    @@ -353,6 +354,99 @@ public void testIntegerFieldsl() throws IOException {
                        assertEquals(Integer.valueOf(888), result.f2);
                        assertEquals(Integer.valueOf(999), result.f3);
                        assertEquals(Integer.valueOf(000), result.f4);
    +
    +                   result = format.nextRecord(result);
    +                   assertNull(result);
    +                   assertTrue(format.reachedEnd());
    +           }
    +           catch (Exception ex) {
    +                   fail("Test failed due to a " + ex.getClass().getName() 
+ ": " + ex.getMessage());
    +           }
    +   }
    +
    +   @Test
    +   public void testEmptyFields() throws IOException {
    +           try {
    +                   final String fileContent = "|0|0|0|0\n" +
    +                           "1||1|1|1|\n" +
    +                           "2|2| |2|2|\n" +
    +                           "3 |3|3|  |3|\n" +
    +                           "4|4|4|4| |\n";
    +                   final FileInputSplit split = 
createTempFile(fileContent);
    +
    +                   final TupleTypeInfo<Tuple5<Short, Integer, Long, Float, 
Double>> typeInfo =
    +                           
TupleTypeInfo.getBasicTupleTypeInfo(Short.class, Integer.class, Long.class, 
Float.class, Double.class);
    +                   final CsvInputFormat<Tuple5<Short, Integer, Long, 
Float, Double>> format = new CsvInputFormat<Tuple5<Short, Integer, Long, Float, 
Double>>(PATH, typeInfo);
    +
    +                   format.setFieldDelimiter("|");
    +
    +                   format.configure(new Configuration());
    +                   format.open(split);
    +
    +                   Tuple5<Short, Integer, Long, Float, Double> result = 
new Tuple5<Short, Integer, Long, Float, Double>();
    +
    +                   try {
    +                           result = format.nextRecord(result);
    +                           fail("Empty String Parse Exception was not 
thrown! (ShortParser)");
    +                   } catch (ParseException e) {}
    +                   try {
    +                           result = format.nextRecord(result);
    +                           fail("Empty String Parse Exception was not 
thrown! (IntegerParser)");
    +                   } catch (ParseException e) {}
    +                   try {
    +                           result = format.nextRecord(result);
    +                           fail("Empty String Parse Exception was not 
thrown! (LongParser)");
    +                   } catch (ParseException e) {}
    +                   try {
    +                           result = format.nextRecord(result);
    --- End diff --
    
    Doesn't this call fail because of the tailing whitespace in the `short` 
field?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to