[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 Input value type - * @param Group Type + * @param T Input value type + * @param R Output value type */ -public interface GroupByFunctionextends 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 Input value type - * @param 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 Input value type - * @param 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-gearpump pull request #131: [GEARPUMP-262] Add setup and teardown ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---