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-4248) CsvTableSource does not support reading SqlTimeTypeInfo types
Date Wed, 21 Sep 2016 10:39:20 GMT

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

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

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

    https://github.com/apache/flink/pull/2303#discussion_r79804683
  
    --- Diff: flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java ---
    @@ -174,6 +174,62 @@ protected void setErrorState(ParseErrorState error) {
     	public ParseErrorState getErrorState() {
     		return this.errorState;
     	}
    +
    +	/**
    +	 * Returns the end position of a string with a numeric format (like XXXX-XX-XX). Sets
the error state if the
    +	 * string contains leading/trailing whitespaces or if the column is empty.
    +	 *
    +	 * @return the end position of the string or -1 if an error occurred
    +	 */
    +	public final int formattedStringEndPos(byte[] bytes, int startPos, int limit, byte[]
delimiter) {
    +		int len = startPos;
    +
    +		final int delimLimit = limit - delimiter.length + 1;
    +
    +		while (len < limit) {
    +			if (len < delimLimit && delimiterNext(bytes, len, delimiter)) {
    +				if (len == startPos) {
    +					setErrorState(ParseErrorState.EMPTY_COLUMN);
    +					return -1;
    +				}
    +				break;
    +			}
    +			len++;
    +		}
    +
    +		if (len > startPos &&
    +				(Character.isWhitespace(bytes[startPos]) || Character.isWhitespace(bytes[(len - 1)])))
{
    +			setErrorState(ParseErrorState.NUMERIC_VALUE_ILLEGAL_CHARACTER);
    +			return -1;
    +		}
    +
    +		return len;
    +	}
    +
    +	/**
    +	 * Returns a string with a numeric format (like XXXX-XX-XX). Throws an exception if
the
    +	 * string contains leading/trailing whitespaces or if the column is empty.
    +	 *
    +	 * @return the parsed string
    +	 */
    +	public static final String formattedString(byte[] bytes, int startPos, int length, char
delimiter) {
    +		if (length <= 0) {
    +			throw new NumberFormatException("Invalid input: Empty string");
    --- End diff --
    
    According to the Javadoc "parseField" should return a `NumberFormatException`.


> CsvTableSource does not support reading SqlTimeTypeInfo types
> -------------------------------------------------------------
>
>                 Key: FLINK-4248
>                 URL: https://issues.apache.org/jira/browse/FLINK-4248
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>    Affects Versions: 1.1.0
>            Reporter: Till Rohrmann
>            Assignee: Timo Walther
>
> The Table API's {{CsvTableSource}} does not support to read all Table API supported data
types. For example, it is not possible to read {{SqlTimeTypeInfo}} types via the {{CsvTableSource}}.



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

Mime
View raw message