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.


---
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