[ https://issues.apache.org/jira/browse/FLINK-1820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14500174#comment-14500174 ]
ASF GitHub Bot commented on FLINK-1820: --------------------------------------- Github user mxm commented on a diff in the pull request: https://github.com/apache/flink/pull/566#discussion_r28610571 --- Diff: flink-core/src/main/java/org/apache/flink/types/parser/IntParser.java --- @@ -37,7 +37,20 @@ public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, I boolean neg = false; final int delimLimit = limit-delimiter.length+1; - + + int delimCount = 0; + for (int i = 0; i < delimiter.length; i++) { + if (bytes[startPos + i] == delimiter[i]) { + delimCount++; + } else { + break; + } + } + if (delimCount == delimiter.length) { + setErrorState(ParseErrorState.EMPTY_STRING); + return -1; + } + --- End diff -- Could you explain why you added this loop and the check afterwards? There is already a function `delimiterNext` which checks if the delimiter comes next. I would suggest to integrate your check in the loop below which already checks for the delimiter using this method. You just need to add an additional condition if no data has been read and throw the error there. > Bug in DoubleParser and FloatParser - empty String is not casted to 0 > --------------------------------------------------------------------- > > Key: FLINK-1820 > URL: https://issues.apache.org/jira/browse/FLINK-1820 > Project: Flink > Issue Type: Bug > Components: Core > Affects Versions: 0.8.0, 0.9, 0.8.1 > Reporter: Felix Neutatz > Assignee: Felix Neutatz > Priority: Critical > Fix For: 0.9 > > > Hi, > I found the bug, when I wanted to read a csv file, which had a line like: > "||\n" > If I treat it as a Tuple2<Long,Long>, I get as expected a tuple (0L,0L). > But if I want to read it into a Double-Tuple or a Float-Tuple, I get the > following error: > java.lang.AssertionError: Test failed due to a > org.apache.flink.api.common.io.ParseException: Line could not be parsed: '||' > ParserError NUMERIC_VALUE_FORMAT_ERROR > This error can be solved by adding an additional condition for empty strings > in the FloatParser / DoubleParser. > We definitely need the CSVReader to be able to read "empty values". > I can fix it like described if there are no better ideas :) -- This message was sent by Atlassian JIRA (v6.3.4#6332)