flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-2025) Support booleans in CSV reader
Date Tue, 19 May 2015 12:04:01 GMT

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

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

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

    https://github.com/apache/flink/pull/685#discussion_r30592154
  
    --- Diff: flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java ---
    @@ -0,0 +1,60 @@
    +/*
    + * 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;
    +
    +public class BooleanParser extends FieldParser<Boolean> {
    +
    +	protected boolean result;
    +
    +	@Override
    +	public int parseField(byte[] bytes, int startPos, int limit, byte[] delim, Boolean reuse)
{
    +		int i = startPos;
    +
    +		final int delimLimit = limit - delim.length + 1;
    +
    +		while (i < limit) {
    +			if (i < delimLimit && delimiterNext(bytes, i, delim)) {
    +				break;
    +			}
    +			i++;
    +		}
    +
    +		String str = new String(bytes, startPos, i - startPos);
    --- End diff --
    
    Not sure how much performance gain we can expect, but I changed the pull request to work
directly on the byte arrays.


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

Mime
View raw message