kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KYLIN-3631) Utilize Arrays#parallelSort for better performance
Date Tue, 20 Nov 2018 02:54:00 GMT

    [ https://issues.apache.org/jira/browse/KYLIN-3631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692581#comment-16692581
] 

ASF GitHub Bot commented on KYLIN-3631:
---------------------------------------

shaofengshi closed pull request #350: Fix issue : KYLIN-3631
URL: https://github.com/apache/kylin/pull/350
 
 
   

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/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
index 87bf9c3c35..c40e766a67 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
@@ -118,8 +118,9 @@ private void testSpanningAndGetParent(CuboidScheduler scheduler, CubeDesc
cube,
         }
 
         long[] spanningsArray = Longs.toArray(totalSpanning);
-        Arrays.sort(spanningsArray);
-        Arrays.sort(expectChildren);
+
+        Arrays.parallelSort(spanningsArray);
+        Arrays.parallelSort(expectChildren);
         assertArrayEquals(expectChildren, spanningsArray);
     }
 
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/Segments.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/Segments.java
index bb68299133..6c4c9a3142 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/Segments.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/Segments.java
@@ -220,7 +220,7 @@ public SegmentRange autoMergeCubeSegments(boolean needAutoMerge, String
cubeName
         // exclude those already under merging segments
         readySegs.removeAll(mergingSegs);
 
-        Arrays.sort(timeRanges);
+        Arrays.parallelSort(timeRanges);
 
         for (int i = timeRanges.length - 1; i >= 0; i--) {
             long toMergeRange = timeRanges[i];
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
index 63a78f89e6..6bbc70c96c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
@@ -308,7 +308,7 @@ public void init(KylinConfig config, String project) {
             setDatabase(getDatabase().toUpperCase(Locale.ROOT));
 
         if (columns != null) {
-            Arrays.sort(columns, new Comparator<ColumnDesc>() {
+            Arrays.parallelSort(columns, new Comparator<ColumnDesc>() {
                 @Override
                 public int compare(ColumnDesc col1, ColumnDesc col2) {
                     Integer id1 = Integer.parseInt(col1.getId());
diff --git a/core-metadata/src/test/java/org/apache/kylin/measure/topn/DoubleDeltaSerializerTest.java
b/core-metadata/src/test/java/org/apache/kylin/measure/topn/DoubleDeltaSerializerTest.java
index e979791df5..30b2e56711 100644
--- a/core-metadata/src/test/java/org/apache/kylin/measure/topn/DoubleDeltaSerializerTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/measure/topn/DoubleDeltaSerializerTest.java
@@ -67,7 +67,8 @@ public void testRandom() {
         for (int i = 0; i < n; i++) {
             nums[i] = rand.nextDouble() * 1000000;
         }
-        Arrays.sort(nums);
+
+        Arrays.parallelSort(nums);
 
         buf.clear();
         dds.serialize(nums, buf);
@@ -86,7 +87,8 @@ public void testRandom2() {
         for (int i = 0; i < n; i++) {
             nums[i] = rand.nextInt();
         }
-        Arrays.sort(nums);
+        
+        Arrays.parallelSort(nums);
 
         buf.clear();
         dds.serialize(nums, buf);


 

----------------------------------------------------------------
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:
users@infra.apache.org


> Utilize Arrays#parallelSort for better performance
> --------------------------------------------------
>
>                 Key: KYLIN-3631
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3631
>             Project: Kylin
>          Issue Type: Improvement
>            Reporter: Ted Yu
>            Assignee: Wu Bin
>            Priority: Minor
>             Fix For: v2.6.0
>
>
> Arrays#parallelSort was introduced since Java 1.8
> We can utilize Arrays#parallelSort to achieve better performance.



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

Mime
View raw message