[
https://issues.apache.org/jira/browse/FLINK-3771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263805#comment-15263805
]
ASF GitHub Bot commented on FLINK-3771:
---------------------------------------
Github user vasia commented on a diff in the pull request:
https://github.com/apache/flink/pull/1900#discussion_r61552674
--- Diff:
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java
---
@@ -0,0 +1,81 @@
+/*
+ * 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.asm.translate;
+
+import org.apache.flink.api.common.functions.MapFunction;
+import org.apache.flink.api.java.DataSet;
+import org.apache.flink.graph.Edge;
+import org.apache.flink.graph.Graph;
+import org.apache.flink.graph.GraphAlgorithm;
+import org.apache.flink.util.Preconditions;
+
+import static
org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
+import static
org.apache.flink.api.common.ExecutionConfig.PARALLELISM_UNKNOWN;
+import static
org.apache.flink.graph.asm.translate.Translate.translateEdgeValues;
+
+/**
+ * Translate {@link Edge} values using the given {@link MapFunction}.
+ *
+ * @param <K> vertex label type
+ * @param <VV> vertex value type
+ * @param <OLD> old edge value type
+ * @param <NEW> new edge value type
+ */
+public class TranslateEdgeValues<K, VV, OLD, NEW>
+implements GraphAlgorithm<K, VV, OLD, Graph<K,VV,NEW>> {
+
+ // Required configuration
+ private MapFunction<OLD,NEW> translator;
+
+ // Optional configuration
+ private int parallelism = PARALLELISM_UNKNOWN;
+
+ /**
+ * Translate {@link Edge} values using the given {@link MapFunction}.
+ *
+ * @param translator implements conversion from {@code OLD} to {@code
NEW}
+ */
+ public TranslateEdgeValues(MapFunction<OLD,NEW> translator) {
+ Preconditions.checkNotNull(translator);
+
--- End diff --
empty line can be removed
> Methods for translating Graphs
> ------------------------------
>
> Key: FLINK-3771
> URL: https://issues.apache.org/jira/browse/FLINK-3771
> Project: Flink
> Issue Type: New Feature
> Components: Gelly
> Affects Versions: 1.1.0
> Reporter: Greg Hogan
> Assignee: Greg Hogan
> Fix For: 1.1.0
>
>
> Provide methods for translation of the type or value of graph labels, vertex
> values, and edge values.
> Sample use cases:
> * shifting graph labels in order to union generated graphs or graphs read
> from multiple sources
> * downsizing labels or values since algorithms prefer to generate wide types
> which may be expensive for further computation
> * changing label type for testing or benchmarking alternative code paths
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)