[ 
https://issues.apache.org/jira/browse/BEAM-5866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gleb Kanterov resolved BEAM-5866.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.10.0

> 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
>             Fix For: 2.10.0
>
>          Time Spent: 7h 50m
>  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