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

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

                Author: ASF GitHub Bot
            Created on: 09/Oct/18 18:27
            Start Date: 09/Oct/18 18:27
    Worklog Time Spent: 10m 
      Work Description: pabloem closed pull request #6611: [BEAM-5685] 
Improving comparator for TopWikipediaSessions
URL: https://github.com/apache/beam/pull/6611
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java
 
b/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java
index b33bbc00732..5eb747fe48f 100644
--- 
a/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java
+++ 
b/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java
@@ -18,6 +18,7 @@
 package org.apache.beam.examples.complete;
 
 import com.google.api.services.bigquery.model.TableRow;
+import com.google.common.collect.ComparisonChain;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.List;
@@ -112,7 +113,11 @@ public void processElement(ProcessContext c) {
     @Override
     public PCollection<List<KV<String, Long>>> expand(PCollection<KV<String, 
Long>> sessions) {
       SerializableComparator<KV<String, Long>> comparator =
-          (o1, o2) -> Long.compare(o1.getValue(), o2.getValue());
+          (o1, o2) ->
+              ComparisonChain.start()
+                  .compare(o1.getValue(), o2.getValue())
+                  .compare(o1.getKey(), o2.getKey())
+                  .result();
       return sessions
           .apply(Window.into(CalendarWindows.months(1)))
           .apply(Top.of(1, comparator).withoutDefaults());
diff --git 
a/examples/java/src/test/java/org/apache/beam/examples/complete/TopWikipediaSessionsIT.java
 
b/examples/java/src/test/java/org/apache/beam/examples/complete/TopWikipediaSessionsIT.java
index 1f278e7f7a7..aa32b485abe 100644
--- 
a/examples/java/src/test/java/org/apache/beam/examples/complete/TopWikipediaSessionsIT.java
+++ 
b/examples/java/src/test/java/org/apache/beam/examples/complete/TopWikipediaSessionsIT.java
@@ -36,7 +36,7 @@
 
   private static final String DEFAULT_INPUT_10_FILES =
       "gs://apache-beam-samples/wikipedia_edits/wiki_data-00000000000*.json";
-  private static final String DEFAULT_OUTPUT_CHECKSUM = 
"a7f0c50b895d0a2e37b78c3f94eadcfb11a647a6";
+  private static final String DEFAULT_OUTPUT_CHECKSUM = 
"61262b08503338bfe4e36b0791958d65e6070933";
 
   /** PipelineOptions for the TopWikipediaSessions integration test. */
   public interface TopWikipediaSessionsITOptions


 

----------------------------------------------------------------
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:
[email protected]


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

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

> TopWikipediaSessionsIT is flaky
> -------------------------------
>
>                 Key: BEAM-5685
>                 URL: https://issues.apache.org/jira/browse/BEAM-5685
>             Project: Beam
>          Issue Type: Bug
>          Components: test-failures
>            Reporter: Pablo Estrada
>            Assignee: Pablo Estrada
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




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

Reply via email to