[
https://issues.apache.org/jira/browse/FLINK-2723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14903521#comment-14903521
]
ASF GitHub Bot commented on FLINK-2723:
---------------------------------------
Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/1169#discussion_r40149941
--- Diff:
flink-core/src/test/java/org/apache/flink/types/CopyableValueTest.java ---
@@ -0,0 +1,121 @@
+/*
+ * 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.types;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CopyableValueTest {
+
+ @Test
+ public void testCopy() {
+ CopyableValue<?>[] value_types = new CopyableValue[] {
+ new BooleanValue(true),
+ new ByteValue((byte) 42),
+ new CharValue('q'),
+ new DoubleValue(3.1415926535897932),
+ new FloatValue((float) 3.14159265),
+ new IntValue(42),
+ new LongValue(42l),
+ new NullValue(),
+ new ShortValue((short) 42),
+ new StringValue("QED")
+ };
+
+ try {
+ for (CopyableValue<?> type : value_types) {
+ assertEquals(type, type.copy());
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
--- End diff --
I know that we have this in other tests as well, but I think it is not
needed, because the test will fail with the stack trace anyways.
> CopyableValue method to copy into new instance
> ----------------------------------------------
>
> Key: FLINK-2723
> URL: https://issues.apache.org/jira/browse/FLINK-2723
> Project: Flink
> Issue Type: New Feature
> Components: Core
> Affects Versions: master
> Reporter: Greg Hogan
> Assignee: Greg Hogan
> Priority: Minor
>
> Provide a method for generic user-defined functions to clone a
> {{CopyableValue}}. A common use case is a {{GroupReduceFunction}} that needs
> to store multiple objects. With object reuse we need to make a deep copy and
> with type erasure we cannot call new.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)