[ 
https://issues.apache.org/jira/browse/FLINK-2025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14549476#comment-14549476
 ] 

ASF GitHub Bot commented on FLINK-2025:
---------------------------------------

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

    https://github.com/apache/flink/pull/685#discussion_r30556035
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/types/parser/BooleanValueParser.java 
---
    @@ -0,0 +1,46 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.types.parser;
    +
    +import org.apache.flink.types.BooleanValue;
    +
    +public class BooleanValueParser extends FieldParser<BooleanValue> {
    +
    +   private BooleanParser parser = new BooleanParser();
    +
    +   private BooleanValue result;
    +
    +   @Override
    +   public int parseField(byte[] bytes, int startPos, int limit, byte[] 
delim, BooleanValue reuse) {
    +           int returnValue = parser.parseField(bytes, startPos, limit, 
delim, reuse.getValue());
    +           setErrorState(parser.getErrorState());
    +           result = new BooleanValue(parser.result);
    --- End diff --
    
    We should use the `reuse` object instead of creating a new instance 
everytime. See the `IntValueParser` for reference.


> Support booleans in CSV reader
> ------------------------------
>
>                 Key: FLINK-2025
>                 URL: https://issues.apache.org/jira/browse/FLINK-2025
>             Project: Flink
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Sebastian Schelter
>            Assignee: Maximilian Michels
>
> It would be great if Flink allowed to read booleans from CSV files, e.g. 1 
> for true and 0 for false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to