You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chiwan Park (JIRA)" <ji...@apache.org> on 2016/04/14 12:57:25 UTC
[jira] [Assigned] (FLINK-3698) Scala Option can't be used as a key
[ 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)