flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chiwan Park (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (FLINK-3698) Scala Option can't be used as a key
Date Thu, 14 Apr 2016 10:57:25 GMT

     [ https://issues.apache.org/jira/browse/FLINK-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Chiwan Park reassigned FLINK-3698:
----------------------------------

    Assignee: Chiwan Park

> Scala Option can't be used as a key
> -----------------------------------
>
>                 Key: FLINK-3698
>                 URL: https://issues.apache.org/jira/browse/FLINK-3698
>             Project: Flink
>          Issue Type: Bug
>          Components: Core
>            Reporter: Timur Fayruzov
>            Assignee: Chiwan Park
>            Priority: Minor
>
> Discussion: http://mail-archives.apache.org/mod_mbox/flink-user/201603.mbox/%3CCAO0MGUjWQaovvUvAB%3DBYrwQzA0ocFtMy4%3DV%3DP--343Sy1V5BSg%40mail.gmail.com%3E
> Option should be treated the same way as other generic objects where it can be used as
a key if generic argument implements Comparable.
> Here's a scalatest in FunSpec format that illustrates the issue:
> ```
> case class MyKey(x: Option[String])
> it("can't use options inside classes used as keys") {
>       val a = env.fromCollection(Seq(MyKey(Some("a")), MyKey(Some("c"))))
>       val b = env.fromCollection(Seq(MyKey(Some("a")), MyKey(Some("z"))))
>       intercept[InvalidProgramException]{
>         a.coGroup(b)
>           .where(e => e)
>           .equalTo(e => e)
>       }
>       // workaround
>       a.coGroup(b)
>         .where(e => e.toString) // `e` should be translated to any object that implements
Comparable interface to be a valid key.
>         .equalTo(e => e.toString)
>     }
> ```



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

Mime
View raw message