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

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

                Author: ASF GitHub Bot
            Created on: 20/Mar/19 20:11
            Start Date: 20/Mar/19 20:11
    Worklog Time Spent: 10m 
      Work Description: kyle-winkelman commented on pull request #8042: 
[BEAM-6812]: Convert keys to ByteArray in Combine.perKey to make sure hashCode 
is consistent
URL: https://github.com/apache/beam/pull/8042#discussion_r267525204
 
 

 ##########
 File path: 
runners/spark/src/main/java/org/apache/beam/runners/spark/translation/TransformTranslator.java
 ##########
 @@ -569,8 +569,8 @@ private static Partitioner 
getPartitioner(EvaluationContext context) {
     Long bundleSize =
         
context.getSerializableOptions().get().as(SparkPipelineOptions.class).getBundleSize();
     return (bundleSize > 0)
-        ? null
-        : new HashPartitioner(context.getSparkContext().defaultParallelism());
+        ? new HashPartitioner(context.getSparkContext().defaultParallelism())
+        : null;
 
 Review comment:
   I agree that the old functionality seems strange, but I remember (when I had 
the logic backwards) that the performance tests for the spark runner were 
impacted. I think the impact was in streaming mode because if you don't use 
this HashPartitioner then it actually does a double shuffle of the data. I 
tried to clean this up but my I never finished getting PR #6511 merged.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 216443)
    Time Spent: 2h 40m  (was: 2.5h)

> Convert keys to ByteArray in Combine.perKey for Spark
> -----------------------------------------------------
>
>                 Key: BEAM-6812
>                 URL: https://issues.apache.org/jira/browse/BEAM-6812
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-spark
>            Reporter: Ankit Jhalaria
>            Assignee: Ankit Jhalaria
>            Priority: Critical
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> * During calls to Combine.perKey, we want they keys used to have consistent 
> hashCode when invoked from different JVM's.
>  * However, while testing this in our company we found out that when using 
> protobuf as keys during combine, the hashCodes can be different for the same 
> key when invoked from different JVMs. This results in duplicates. 
>  * `ByteArray` class in Spark has a stable has code when dealing with arrays 
> as well. 
>  * GroupByKey correctly converts keys to `ByteArray` and uses coders for 
> serialization.
>  * The fix does something similar when dealing with combines.



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

Reply via email to