flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hubert Czerpak (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-3001) Add Support for Java 8 Optional type
Date Thu, 19 Nov 2015 13:15:11 GMT

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

Hubert Czerpak commented on FLINK-3001:
---------------------------------------

Optionals shouldn't be stored at all. Its purpose in Java8 is to be used as return value from
functions. But whenever you want to use its value (e.g. store in a variable) you need to extract
it from the optional. It may be different than optionals in other languages but Oracle recommends
avoiding identity-sensitive operations. E.g. in cases of sorting I think optionals shouldn't
be on the sorted collection but their values.

> Add Support for Java 8 Optional type
> ------------------------------------
>
>                 Key: FLINK-3001
>                 URL: https://issues.apache.org/jira/browse/FLINK-3001
>             Project: Flink
>          Issue Type: New Feature
>          Components: Java API
>    Affects Versions: 0.10.0
>            Reporter: Stephan Ewen
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> Using {{Optional}} is a good way to handle nullable fields.
> The missing support for null fields in tuples can be easily handled by using {{Optional<T>}}
for nullable fields and {{T}} directly for non nullable fields.
> That also retains best serialization efficiency.
> Since we cannot always assume the presence of {{Optional}} (only introduced in Java8),
the TypeExtractor needs to analyze and create that TypeInfo with reflection.
> Further more, we need to add the OptionalTypeInfo to the flink-java8 project and people
need to include flink-java8 in their project if they want to use the Optional.



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

Mime
View raw message