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-5481) Cannot create Collection of Row
Date Tue, 17 Jan 2017 13:53:26 GMT

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

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

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

    https://github.com/apache/flink/pull/3127#discussion_r96414774
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java
---
    @@ -1916,6 +1918,46 @@ else if (value instanceof Row) {
     		}
     	}
     
    +	public static <X> TypeInformation<X> getForCollection(Iterable<X>
value) {
    +		return new TypeExtractor().privateGetForIterable(value);
    +	}
    +
    +	public static <X> TypeInformation<X> getForCollection(X[] value) {
    +		return new TypeExtractor().privateGetForIterable(Arrays.asList(value));
    +	}
    +
    +	@SuppressWarnings({ "unchecked", "rawtypes" })
    +	private <X> TypeInformation<X> privateGetForIterable(Iterable<X> value)
{
    +		checkNotNull(value);
    +
    +		Iterator<X> it = value.iterator();
    +		X v = checkNotNull(it.next());
    +
    +		if (v instanceof Row) {
    --- End diff --
    
    So this only works if there is one `Row` for which every field is not null? Why not instead
search the type of every column separately, and then create the `RowTypeInfo` manually? Then
it would only fail if one field is null for every `Row`.


> Cannot create Collection of Row 
> --------------------------------
>
>                 Key: FLINK-5481
>                 URL: https://issues.apache.org/jira/browse/FLINK-5481
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Anton Solovev
>            Assignee: Anton Solovev
>            Priority: Trivial
>
> When we use {{ExecutionEnvironment#fromElements(X... data)}} it takes first element of
{{data}} to define a type. If first Row in collection has wrong number of fields (there are
nulls) TypeExtractor returns not RowTypeInfo, but GenericType<Row>



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

Mime
View raw message