[ 
https://issues.apache.org/jira/browse/BEAM-5866?focusedWorklogId=159147&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-159147
 ]

ASF GitHub Bot logged work on BEAM-5866:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Oct/18 11:43
            Start Date: 26/Oct/18 11:43
    Worklog Time Spent: 10m 
      Work Description: kanterov commented on a change in pull request #6845: 
[BEAM-5866] Override structuralValue in Row and Map coders
URL: https://github.com/apache/beam/pull/6845#discussion_r228496688
 
 

 ##########
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/coders/CoderTestUtils.java
 ##########
 @@ -0,0 +1,83 @@
+/*
+ * 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.beam.sdk.coders;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public class CoderTestUtils {
 
 Review comment:
   Just discovered there is `CoderProperties` with such functions, probably it 
should go there

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 159147)
    Time Spent: 0.5h  (was: 20m)

> RowCoder doesn't implement structuralValue
> ------------------------------------------
>
>                 Key: BEAM-5866
>                 URL: https://issues.apache.org/jira/browse/BEAM-5866
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Gleb Kanterov
>            Assignee: Gleb Kanterov
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> These two properties fail for RowCoder with `BYTES` field, or `Map<BYTES, ?>` 
> field. 
> {code}
>   public static <T> void testConsistentWithEquals(Coder<T> coder, T example) {
>     assumeTrue(coder.consistentWithEquals());
>     byte[] bytes = encodeBytes(coder, example);
>     // even if the coder is non-deterministic, if the encoded bytes match,
>     // coder is consistent with equals, decoded values must be equal
>     T out0 = decodeBytes(coder, bytes);
>     T out1 = decodeBytes(coder, bytes);
>     assertEquals("If the encoded bytes match, decoded values must be equal", 
> out0, out1);
>     assertEquals(
>         "If two values are equal, their hash codes must be equal",
>         out0.hashCode(),
>         out1.hashCode());
>   }
>   public static <T> void testStructuralValueConsistentWithEquals(Coder<T> 
> coder, T example) {
>     byte[] bytes = encodeBytes(coder, example);
>     // even if coder is non-deterministic, if the encoded bytes match,
>     // structural values must be equal
>     Object out0 = coder.structuralValue(decodeBytes(coder, bytes));
>     Object out1 = coder.structuralValue(decodeBytes(coder, bytes));
>     assertEquals("If the encoded bytes match, structural values must be 
> equal", out0, out1);
>     assertEquals(
>         "If two values are equal, their hash codes must be equal",
>         out0.hashCode(),
>         out1.hashCode());
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to