[ https://issues.apache.org/jira/browse/FLINK-3771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263770#comment-15263770 ]
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_r61551238 --- Diff: flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/LongValueToIntValue.java --- @@ -0,0 +1,47 @@ +/* + * 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.types.IntValue; +import org.apache.flink.types.LongValue; + +/** + * Translate {@link LongValue} to {@link IntValue}. + * + * Throws {@link RuntimeException} for integer overflow. + */ +public class LongValueToIntValue +implements MapFunction<LongValue, IntValue> { + + private IntValue output = new IntValue(); + + @Override + public IntValue map(LongValue value) + throws Exception { --- End diff -- can be moved to the line above > 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)