You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2016/02/04 17:46:48 UTC
[1/2] flink git commit: [streaming] [scala] Scala wrapper for
DataStreamUtils
Repository: flink
Updated Branches:
refs/heads/master 69f7f6d92 -> 4852302a1
[streaming] [scala] Scala wrapper for DataStreamUtils
This closes #1574
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/4852302a
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/4852302a
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/4852302a
Branch: refs/heads/master
Commit: 4852302a1b0e2254ca0be283f363e70e867e7b54
Parents: 116337f
Author: Márton Balassi <mb...@apache.org>
Authored: Tue Feb 2 14:18:05 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Feb 4 17:29:08 2016 +0100
----------------------------------------------------------------------
flink-contrib/flink-streaming-contrib/pom.xml | 137 +++++++++++++++++++
.../contrib/streaming/scala/utils/package.scala | 48 +++++++
2 files changed, 185 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/4852302a/flink-contrib/flink-streaming-contrib/pom.xml
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/pom.xml b/flink-contrib/flink-streaming-contrib/pom.xml
index e608334..88ecf20 100644
--- a/flink-contrib/flink-streaming-contrib/pom.xml
+++ b/flink-contrib/flink-streaming-contrib/pom.xml
@@ -44,6 +44,11 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
+ <artifactId>flink-streaming-scala_2.10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
<artifactId>flink-clients_2.10</artifactId>
<version>${project.version}</version>
</dependency>
@@ -79,4 +84,136 @@ under the License.
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <!-- Scala Compiler -->
+ <plugin>
+ <groupId>net.alchim31.maven</groupId>
+ <artifactId>scala-maven-plugin</artifactId>
+ <version>3.1.4</version>
+ <executions>
+ <!-- Run scala compiler in the process-resources phase, so that dependencies on
+ scala classes can be resolved later in the (Java) compile phase -->
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+
+ <!-- Run scala compiler in the process-test-resources phase, so that dependencies on
+ scala classes can be resolved later in the (Java) test-compile phase -->
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jvmArgs>
+ <jvmArg>-Xms128m</jvmArg>
+ <jvmArg>-Xmx512m</jvmArg>
+ </jvmArgs>
+ <compilerPlugins combine.children="append">
+ <compilerPlugin>
+ <groupId>org.scalamacros</groupId>
+ <artifactId>paradise_${scala.version}</artifactId>
+ <version>${scala.macros.version}</version>
+ </compilerPlugin>
+ </compilerPlugins>
+ </configuration>
+ </plugin>
+
+ <!-- Eclipse Integration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <projectnatures>
+ <projectnature>org.scala-ide.sdt.core.scalanature</projectnature>
+ <projectnature>org.eclipse.jdt.core.javanature</projectnature>
+ </projectnatures>
+ <buildcommands>
+ <buildcommand>org.scala-ide.sdt.core.scalabuilder</buildcommand>
+ </buildcommands>
+ <classpathContainers>
+ <classpathContainer>org.scala-ide.sdt.launching.SCALA_CONTAINER</classpathContainer>
+ <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+ </classpathContainers>
+ <excludes>
+ <exclude>org.scala-lang:scala-library</exclude>
+ <exclude>org.scala-lang:scala-compiler</exclude>
+ </excludes>
+ <sourceIncludes>
+ <sourceInclude>**/*.scala</sourceInclude>
+ <sourceInclude>**/*.java</sourceInclude>
+ </sourceIncludes>
+ </configuration>
+ </plugin>
+
+ <!-- Adding scala source directories to build path -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <!-- Add src/main/scala to eclipse build path -->
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/scala</source>
+ </sources>
+ </configuration>
+ </execution>
+ <!-- Add src/test/scala to eclipse build path -->
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/test/scala</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.scalastyle</groupId>
+ <artifactId>scalastyle-maven-plugin</artifactId>
+ <version>0.5.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <verbose>false</verbose>
+ <failOnViolation>true</failOnViolation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <failOnWarning>false</failOnWarning>
+ <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
+ <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
+ <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
+ <outputFile>${project.basedir}/scalastyle-output.xml</outputFile>
+ <outputEncoding>UTF-8</outputEncoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/flink/blob/4852302a/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala b/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala
new file mode 100644
index 0000000..86a2bdc
--- /dev/null
+++ b/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala
@@ -0,0 +1,48 @@
+/*
+ * 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.flink.contrib.streaming.scala
+
+import org.apache.flink.api.common.typeinfo.TypeInformation
+import org.apache.flink.contrib.streaming.{DataStreamUtils => JavaStreamUtils}
+import org.apache.flink.streaming.api.scala._
+
+import _root_.scala.reflect.ClassTag
+import scala.collection.JavaConverters._
+
+package object utils {
+
+ /**
+ * This class provides simple utility methods for collecting a [[DataStream]],
+ * effectively enriching it with the functionality encapsulated by [[JavaStreamUtils]].
+ *
+ * @param self DataStream
+ */
+ implicit class DataStreamUtils[T: TypeInformation : ClassTag](val self: DataStream[T]) {
+
+ /**
+ * Returns a scala iterator to iterate over the elements of the DataStream.
+ * @return The iterator
+ */
+ def collect() : Iterator[T] = {
+ JavaStreamUtils.collect(self.javaStream).asScala
+ }
+
+ }
+
+}
[2/2] flink git commit: [streaming] [scala] Revert removing
getJavaStream() from DataStream
Posted by se...@apache.org.
[streaming] [scala] Revert removing getJavaStream() from DataStream
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/116337fc
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/116337fc
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/116337fc
Branch: refs/heads/master
Commit: 116337fc77c86dc69b38bb20fa7774d36dfb5f03
Parents: 69f7f6d
Author: Márton Balassi <mb...@apache.org>
Authored: Tue Feb 2 14:10:47 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Feb 4 17:29:08 2016 +0100
----------------------------------------------------------------------
.../scala/org/apache/flink/streaming/api/scala/DataStream.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/116337fc/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
----------------------------------------------------------------------
diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
index 69a8dc5..0c3d936 100644
--- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
+++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
@@ -44,7 +44,7 @@ class DataStream[T](stream: JavaStream[T]) {
/**
* Gets the underlying java DataStream object.
*/
- private[flink] def javaStream: JavaStream[T] = stream
+ def javaStream: JavaStream[T] = stream
/**
* Returns the [[StreamExecutionEnvironment]] associated with the current [[DataStream]].
@@ -130,7 +130,7 @@ class DataStream[T](stream: JavaStream[T]) {
case _ => throw new UnsupportedOperationException("Only supported for operators.")
this
}
-
+
/**
* Turns off chaining for this operator so thread co-location will not be
* used as an optimization. </p> Chaining can be turned off for the whole