[
https://issues.apache.org/jira/browse/FLINK-2716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15093668#comment-15093668
]
ASF GitHub Bot commented on FLINK-2716:
---------------------------------------
Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/1462#discussion_r49434439
--- Diff:
flink-libraries/flink-gelly-scala/src/main/scala/org/apache/flink/graph/scala/utils/package.scala
---
@@ -0,0 +1,51 @@
+/*
+ * 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.graph.scala
+
+import org.apache.flink.api.common.typeinfo.TypeInformation
+import org.apache.flink.api.java.Utils.Checksum
+import org.apache.flink.api.scala._
+import org.apache.flink.api.scala.utils._
+
+import scala.reflect.ClassTag
+
+package object utils {
+ /**
+ * This class provides utility methods for computing checksums over a
Graph.
+ *
+ * @param self Graph
+ */
+ implicit class GraphSetUtils[K: TypeInformation : ClassTag, VV:
TypeInformation : ClassTag, EV:
+ TypeInformation : ClassTag](val self: Graph[K, VV, EV]) {
+
+ /**
+ * Computes the checksum over the Graph
+ *
+ * @return the checksum over the vertices and edges.
+ */
+ @throws(classOf[Exception])
+ def checksumHashCode[K: TypeInformation : ClassTag, VV:
TypeInformation : ClassTag, EV:
+ TypeInformation : ClassTag]: Checksum = {
+ val checksum: Checksum = self.getVertices.checksumHashCode
+ checksum.add(self.getEdges.checksumHashCode)
+ return checksum
--- End diff --
`return` is not necessary here. Scala takes the last expression as the
return value.
> Checksum method for DataSet and Graph
> -------------------------------------
>
> Key: FLINK-2716
> URL: https://issues.apache.org/jira/browse/FLINK-2716
> Project: Flink
> Issue Type: Improvement
> Components: Gelly, Java API, Scala API
> Affects Versions: 0.10.0
> Reporter: Greg Hogan
> Assignee: Greg Hogan
> Priority: Minor
>
> {{DataSet.count()}}, {{Graph.numberOfVertices()}}, and
> {{Graph.numberOfEdges()}} provide measures of the number of distributed data
> elements. New {{DataSet.checksum()}} and {{Graph.checksum()}} methods will
> summarize the content of data elements and support algorithm validation,
> integration testing, and benchmarking.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)