[
https://issues.apache.org/jira/browse/FLINK-1159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15163134#comment-15163134
]
ASF GitHub Bot commented on FLINK-1159:
---------------------------------------
Github user tillrohrmann commented on the pull request:
https://github.com/apache/flink/pull/1704#issuecomment-188289230
Thanks for your contribution @stefanobaghino. I really like this feature a
lot :-)
Currently, the implementation is not complete, because the supported set of
API calls is not complete.
With the current packaging structure one would always have to import
`org.apache.flink.api.scala.extensions.acceptPartialFunctions._`. I would
rather like to import the following to get partial function support
`org.apache.flink.api.scala.extensions.acceptPartialFunctions` or if I want to
import all extensions: `org.apache.flink.api.scala.extensions._`. We could
achieve this by introducing an `extensions` package object which does something
like:
```
package object extensions {
implicit def acceptPartialFunctions[T: TypeInformation](ds:
DataStream[T]):
DataStreamWithPartialFunctionSupport[T] = {
new DataStreamWithPartialFunctionSupport[T](ds)
}
```
What do you think?
> Case style anonymous functions not supported by Scala API
> ---------------------------------------------------------
>
> Key: FLINK-1159
> URL: https://issues.apache.org/jira/browse/FLINK-1159
> Project: Flink
> Issue Type: Bug
> Components: Scala API
> Reporter: Till Rohrmann
> Assignee: Stefano Baghino
>
> In Scala it is very common to define anonymous functions of the following form
> {code}
> {
> case foo: Bar => foobar(foo)
> case _ => throw new RuntimeException()
> }
> {code}
> These case style anonymous functions are not supported yet by the Scala API.
> Thus, one has to write redundant code to name the function parameter.
> What works is the following pattern, but it is not intuitive for someone
> coming from Scala:
> {code}
> dataset.map{
> _ match{
> case foo:Bar => ...
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)