GitHub user stefanobaghino opened a pull request:
https://github.com/apache/flink/pull/1704
[FLINK-1159] Case style anonymous functions not supported by Scala API
The proposed API extension methods would allow developers to pass a pattern
matching anonymous function so that they are applied on a `DataSet` or
`DataStream`; many methods defined on the `DataSet` and `DataStream` APIs don't
support those functions due to the overloading[[1]][[2]]; pattern matching
anonymous functions allow a very idiomatic approach in Scala to *decompose
tuples, case classes and collections*.
The PR does not pollute the original `DataSet` and `DataStream` APIs but is
provided as an optional set of extensions methods, implemented via implicit
conversions and made available to the developer by explicitly importing the
required package, e.g.:
```scala
import org.apache.flink.api.scala.extensions.acceptPartialFunctions
env.fromElements('a -> 1, 'b -> 2).mapWith {
case (key, value) =>
... // key and value are now available and have a sensible name
}
```
[1]: https://groups.google.com/d/msg/scala-user/3oHnDEl1UsM/dDNir9BsiG4J
[2]:
http://www.scala-lang.org/files/archive/spec/2.11/06-expressions.html#overloading-resolution
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/radicalbit/flink 1159
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/1704.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1704
----
commit 61d184075cce9fa4f3a8e477634adef083d3a070
Author: Stefano Baghino <[email protected]>
Date: 2016-02-24T12:05:16Z
[FLINK-1159] Case style anonymous functions not supported by Scala API
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---