You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gearpump.apache.org by manuzhang <gi...@git.apache.org> on 2017/01/13 07:06:39 UTC
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
GitHub user manuzhang opened a pull request:
https://github.com/apache/incubator-gearpump/pull/131
[GEARPUMP-262] Add setup and teardown to user defined functions
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
- [ ] Make sure the commit message is formatted like:
`[GEARPUMP-<Jira issue #>] Meaningful description of pull request`
- [ ] Make sure tests pass via `sbt clean test`.
- [ ] Make sure old documentation affected by the pull request has been updated and new documentation added for new functionality.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/manuzhang/incubator-gearpump setup_teardown
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-gearpump/pull/131.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 #131
----
commit adcb32f3470d4f31b11da773cb1cad6ffe05aacc
Author: manuzhang <ow...@gmail.com>
Date: 2017-01-13T06:39:05Z
[GEARPUMP-262] Add setup and teardown to user defined functions
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump issue #131: [GEARPUMP-262] Add setup and teardown to user...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on the issue:
https://github.com/apache/incubator-gearpump/pull/131
@huafengw the unidoc failure has been fixed
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95946656
--- Diff: examples/streaming/kafka/src/main/scala/org/apache/gearpump/streaming/examples/kafka/dsl/KafkaReadWrite.scala ---
@@ -21,8 +21,8 @@ package org.apache.gearpump.streaming.examples.kafka.dsl
import java.util.Properties
import org.apache.gearpump.cluster.client.ClientContext
-import org.apache.gearpump.cluster.main.{CLIOption, ArgumentsParser}
-import org.apache.gearpump.streaming.dsl.StreamApp
+import org.apache.gearpump.cluster.main.{ArgumentsParser, CLIOption}
+import org.apache.gearpump.streaming.dsl.scalaapi.StreamApp
--- End diff --
dsl packages are restructured into `dsl.api` for common interfaces, `dsl.scalaapi` for Scala and `dsl.javaapi` for Java.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95948751
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/scalaapi/Stream.scala ---
@@ -36,55 +38,95 @@ class Stream[T](
private val edge: Option[OpEdge] = None) {
/**
- * converts a value[T] to a list of value[R]
+ * Returns a new stream by applying a flatMap function to each element
+ * and flatten the results.
*
- * @param fn FlatMap function
+ * @param fn flatMap function
* @param description The description message for this operation
* @return A new stream with type [R]
*/
def flatMap[R](fn: T => TraversableOnce[R], description: String = "flatMap"): Stream[R] = {
- val flatMapOp = ChainableOp(new FlatMapFunction[T, R](fn, description))
- graph.addVertex(flatMapOp)
- graph.addEdge(thisNode, edge.getOrElse(Direct), flatMapOp)
- new Stream[R](graph, flatMapOp)
+ this.flatMap(FlatMapFunction(fn), description)
}
/**
- * Maps message of type T message of type R
+ * Returns a new stream by applying a [[FlatMapFunction]] to each element
+ * and flatten the results.
*
- * @param fn Function
+ * @param fn [[FlatMapFunction]]
+ * @param description The description message for this operation
+ * @return A new stream with type [R]
+ */
+ def flatMap[R](fn: FlatMapFunction[T, R], description: String): Stream[R] = {
+ transform(new FlatMapper[T, R](fn, description))
+ }
+
+ /**
+ * Returns a new stream by applying a map function to each element.
+ *
+ * @param fn map function
* @return A new stream with type [R]
*/
def map[R](fn: T => R, description: String = "map"): Stream[R] = {
- this.flatMap({ data =>
- Option(fn(data))
- }, description)
+ this.map(MapFunction(fn), description)
+ }
+
+ /**
+ * Returns a new stream by applying a [[MapFunction]] to each element.
+ *
+ * @param fn [[MapFunction]]
+ * @return A new stream with type [R]
+ */
+ def map[R](fn: MapFunction[T, R], description: String): Stream[R] = {
+ this.flatMap(FlatMapFunction(fn), description)
--- End diff --
Should it be `map` here?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95947926
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/api/functions/FilterFunction.scala ---
@@ -15,17 +15,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.gearpump.streaming.dsl.api.functions
-package org.apache.gearpump.streaming.javaapi.dsl.functions;
+import org.apache.gearpump.streaming.dsl.scalaapi.functions.SerializableFunction
-import java.io.Serializable;
+object FilterFunction {
+
+ def apply[T](fn: T => Boolean): FilterFunction[T] = {
+ new FilterFunction[T] {
+ override def apply(t: T): Boolean = {
+ fn(t)
+ }
+ }
+ }
+}
/**
- * Function that map a value of type T to value of type R
+ * Returns true to keep the input and false otherwise.
*
- * @param <T> Input value type
- * @param <R> Output value type
+ * @tparam T Input value type
--- End diff --
typo?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95949377
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/scalaapi/functions/FlatMapFunction.scala ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gearpump.streaming.dsl.scalaapi.functions
+
+import org.apache.gearpump.streaming.dsl.api.functions.{FilterFunction, MapFunction}
+import org.apache.gearpump.streaming.dsl.javaapi.functions.{FlatMapFunction => JFlatMapFunction}
+
+import scala.collection.JavaConverters._
+
+object FlatMapFunction {
+
+ def apply[T, R](fn: JFlatMapFunction[T, R]): FlatMapFunction[T, R] = {
+ new FlatMapFunction[T, R] {
--- End diff --
good catch
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95956884
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/javaapi/JavaStream.scala ---
@@ -31,23 +31,23 @@ import org.apache.gearpump.streaming.task.Task
class JavaStream[T](val stream: Stream[T]) {
/** FlatMap on stream */
- def flatMap[R](fn: FlatMapFunction[T, R], description: String): JavaStream[R] = {
- new JavaStream[R](stream.flatMap({ t: T => fn(t).asScala }, description))
+ def flatMap[R](fn: functions.FlatMapFunction[T, R], description: String): JavaStream[R] = {
+ new JavaStream[R](stream.flatMap(FlatMapFunction(fn), "flatMap"))
--- End diff --
updated
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95949237
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/scalaapi/functions/FlatMapFunction.scala ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gearpump.streaming.dsl.scalaapi.functions
+
+import org.apache.gearpump.streaming.dsl.api.functions.{FilterFunction, MapFunction}
+import org.apache.gearpump.streaming.dsl.javaapi.functions.{FlatMapFunction => JFlatMapFunction}
+
+import scala.collection.JavaConverters._
+
+object FlatMapFunction {
+
+ def apply[T, R](fn: JFlatMapFunction[T, R]): FlatMapFunction[T, R] = {
+ new FlatMapFunction[T, R] {
--- End diff --
why JFlatMapFunction does not call `setup` and `teardown`?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95948836
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/scalaapi/Stream.scala ---
@@ -36,55 +38,95 @@ class Stream[T](
private val edge: Option[OpEdge] = None) {
/**
- * converts a value[T] to a list of value[R]
+ * Returns a new stream by applying a flatMap function to each element
+ * and flatten the results.
*
- * @param fn FlatMap function
+ * @param fn flatMap function
* @param description The description message for this operation
* @return A new stream with type [R]
*/
def flatMap[R](fn: T => TraversableOnce[R], description: String = "flatMap"): Stream[R] = {
- val flatMapOp = ChainableOp(new FlatMapFunction[T, R](fn, description))
- graph.addVertex(flatMapOp)
- graph.addEdge(thisNode, edge.getOrElse(Direct), flatMapOp)
- new Stream[R](graph, flatMapOp)
+ this.flatMap(FlatMapFunction(fn), description)
}
/**
- * Maps message of type T message of type R
+ * Returns a new stream by applying a [[FlatMapFunction]] to each element
+ * and flatten the results.
*
- * @param fn Function
+ * @param fn [[FlatMapFunction]]
+ * @param description The description message for this operation
+ * @return A new stream with type [R]
+ */
+ def flatMap[R](fn: FlatMapFunction[T, R], description: String): Stream[R] = {
+ transform(new FlatMapper[T, R](fn, description))
+ }
+
+ /**
+ * Returns a new stream by applying a map function to each element.
+ *
+ * @param fn map function
* @return A new stream with type [R]
*/
def map[R](fn: T => R, description: String = "map"): Stream[R] = {
- this.flatMap({ data =>
- Option(fn(data))
- }, description)
+ this.map(MapFunction(fn), description)
+ }
+
+ /**
+ * Returns a new stream by applying a [[MapFunction]] to each element.
+ *
+ * @param fn [[MapFunction]]
+ * @return A new stream with type [R]
+ */
+ def map[R](fn: MapFunction[T, R], description: String): Stream[R] = {
+ this.flatMap(FlatMapFunction(fn), description)
--- End diff --
never mind, I got it.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95954841
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/javaapi/functions/FlatMapFunction.scala ---
@@ -15,17 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.gearpump.streaming.dsl.javaapi.functions
-package org.apache.gearpump.streaming.javaapi.dsl.functions;
-
-import java.io.Serializable;
+import org.apache.gearpump.streaming.dsl.scalaapi.functions.SerializableFunction
/**
- * GroupBy function which assign value of type T to groups
+ * Transforms one input into zero or more outputs of possibly different types.
+ * This Java version of FlatMapFunction returns a java.util.Iterator.
*
- * @param <T> Input value type
- * @param <Group> Group Type
+ * @param T Input value type
+ * @param R Output value type
*/
-public interface GroupByFunction<T, Group> extends Serializable {
- Group apply(T t);
+abstract class FlatMapFunction[T, R] extends SerializableFunction {
--- End diff --
Do you think just call it JFlatMapFunction will be less confusing?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump issue #131: [GEARPUMP-262] Add setup and teardown to user...
Posted by codecov-io <gi...@git.apache.org>.
Github user codecov-io commented on the issue:
https://github.com/apache/incubator-gearpump/pull/131
## [Current coverage](https://codecov.io/gh/apache/incubator-gearpump/pull/131?src=pr) is 70.57% (diff: 64.91%)
> Merging [#131](https://codecov.io/gh/apache/incubator-gearpump/pull/131?src=pr) into [master](https://codecov.io/gh/apache/incubator-gearpump/branch/master?src=pr) will increase coverage by **0.06%**
```diff
@@ master #131 diff @@
==========================================
Files 186 191 +5
Lines 5989 6016 +27
Methods 5479 5496 +17
Messages 0 0
Branches 508 518 +10
==========================================
+ Hits 4223 4246 +23
- Misses 1766 1770 +4
Partials 0 0
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [385a612...6309a02](https://codecov.io/gh/apache/incubator-gearpump/compare/385a612bb916512fdf40afc8cc9c8cab888554c1...6309a02efafd7e5f08ee9b104b3420518c4aeaad?src=pr)
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95948972
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/api/functions/FilterFunction.scala ---
@@ -15,17 +15,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.gearpump.streaming.dsl.api.functions
-package org.apache.gearpump.streaming.javaapi.dsl.functions;
+import org.apache.gearpump.streaming.dsl.scalaapi.functions.SerializableFunction
-import java.io.Serializable;
+object FilterFunction {
+
+ def apply[T](fn: T => Boolean): FilterFunction[T] = {
+ new FilterFunction[T] {
+ override def apply(t: T): Boolean = {
+ fn(t)
+ }
+ }
+ }
+}
/**
- * Function that map a value of type T to value of type R
+ * Returns true to keep the input and false otherwise.
*
- * @param <T> Input value type
- * @param <R> Output value type
+ * @tparam T Input value type
--- End diff --
this is auto-generated and causes `sbt unidoc` to fail. I'm fixing it.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump issue #131: [GEARPUMP-262] Add setup and teardown to user...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on the issue:
https://github.com/apache/incubator-gearpump/pull/131
+1
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95956985
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/javaapi/functions/FlatMapFunction.scala ---
@@ -15,17 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.gearpump.streaming.dsl.javaapi.functions
-package org.apache.gearpump.streaming.javaapi.dsl.functions;
-
-import java.io.Serializable;
+import org.apache.gearpump.streaming.dsl.scalaapi.functions.SerializableFunction
/**
- * GroupBy function which assign value of type T to groups
+ * Transforms one input into zero or more outputs of possibly different types.
+ * This Java version of FlatMapFunction returns a java.util.Iterator.
*
- * @param <T> Input value type
- * @param <Group> Group Type
+ * @param T Input value type
+ * @param R Output value type
*/
-public interface GroupByFunction<T, Group> extends Serializable {
- Group apply(T t);
+abstract class FlatMapFunction[T, R] extends SerializableFunction {
--- End diff --
it's already under the `javaapi` package.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/incubator-gearpump/pull/131
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95946687
--- Diff: examples/streaming/wordcount-java/src/main/java/org/apache/gearpump/streaming/examples/wordcountjava/dsl/WordCount.java ---
@@ -25,12 +25,17 @@
import org.apache.gearpump.cluster.client.ClientContext;
import org.apache.gearpump.streaming.dsl.javaapi.JavaStream;
import org.apache.gearpump.streaming.dsl.javaapi.JavaStreamApp;
+import org.apache.gearpump.streaming.dsl.api.functions.MapFunction;
--- End diff --
dsl packages are restructured into `dsl.api` for common interfaces, `dsl.scalaapi` for Scala and `dsl.javaapi` for Java.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by huafengw <gi...@git.apache.org>.
Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95955067
--- Diff: streaming/src/main/scala/org/apache/gearpump/streaming/dsl/javaapi/JavaStream.scala ---
@@ -31,23 +31,23 @@ import org.apache.gearpump.streaming.task.Task
class JavaStream[T](val stream: Stream[T]) {
/** FlatMap on stream */
- def flatMap[R](fn: FlatMapFunction[T, R], description: String): JavaStream[R] = {
- new JavaStream[R](stream.flatMap({ t: T => fn(t).asScala }, description))
+ def flatMap[R](fn: functions.FlatMapFunction[T, R], description: String): JavaStream[R] = {
+ new JavaStream[R](stream.flatMap(FlatMapFunction(fn), "flatMap"))
--- End diff --
FlatMapFunction(fn: FlatMapFunction) is kind of weird
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
Posted by manuzhang <gi...@git.apache.org>.
Github user manuzhang commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/131#discussion_r95946766
--- Diff: examples/streaming/wordcount-java/src/main/java/org/apache/gearpump/streaming/examples/wordcountjava/dsl/WordCount.java ---
@@ -46,15 +51,13 @@ public static void main(Config akkaConf, String[] args) throws InterruptedExcept
JavaStream<String> sentence = app.source(new StringSource("This is a good start, bingo!! bingo!!"),
1, UserConfig.empty(), "source");
- JavaStream<String> words = sentence.flatMap(s -> Arrays.asList(s.split("\\s+")).iterator(),
- "flatMap");
+ JavaStream<String> words = sentence.flatMap(new Split(), "flatMap");
- JavaStream<Tuple2<String, Integer>> ones = words.map(s -> new Tuple2<>(s, 1), "map");
+ JavaStream<Tuple2<String, Integer>> ones = words.map(new Ones(), "map");
--- End diff --
With the addition of `setup` and `teardown` methods, Java 8 lambda functions no longer work.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---