-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add streaming aggregation as the last step of ConcurrentGrouper if data are spilled #4704
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
0e68c08
Add steaming grouper
jihoonson 30c0038
Fix doc
jihoonson c79959f
Use a single dictionary while combining
jihoonson 21d42ce
Revert GroupByBenchmark
jihoonson 701adb1
Removed unused code
jihoonson 68ccece
More cleanup
jihoonson 29a7dfe
Remove unused config
jihoonson 48dc2cd
Fix some typos and bugs
jihoonson 92675a9
Refactor Groupers.mergeIterators()
jihoonson a888db0
Add comments for combining tree
jihoonson 7040ffb
Refactor buildCombineTree
jihoonson 5c4b846
Refactor iterator
jihoonson f31f6d2
Add ParallelCombiner
jihoonson 3cdce75
Add ParallelCombinerTest
jihoonson 2a619b9
Handle InterruptedException
jihoonson 3f14db4
use AbstractPrioritizedCallable
jihoonson dee9633
Address comments
jihoonson c0eecc0
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson 0f5c3a8
[maven-release-plugin] prepare release druid-0.11.0-sg
jihoonson 5c6b31e
[maven-release-plugin] prepare for next development iteration
jihoonson 9258453
Address comments
jihoonson de73645
Revert "[maven-release-plugin] prepare for next development iteration"
jihoonson 5a87879
Revert "[maven-release-plugin] prepare release druid-0.11.0-sg"
jihoonson e0699c2
Fix build failure
jihoonson 324201c
Change list to array
jihoonson b748da5
rename sortableIds
jihoonson 91ed8a2
Address comments
jihoonson 8585062
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson a9a43b8
change to foreach loop
jihoonson e7144bb
Fix comment
jihoonson 3343392
Revert keyEquals()
jihoonson 4628c5e
Remove loop
jihoonson 4369c3b
Address comments
jihoonson 0beacc3
Fix build fail
jihoonson 08d1ed6
Address comments
jihoonson ac5a024
Remove unused imports
jihoonson 02264a1
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson f168b74
Fix method name
jihoonson be123c1
Split intermediate and leaf combine degrees
jihoonson 919ecbd
Add comments to StreamingMergeSortedGrouper
jihoonson aa1249a
Add more comments and fix overflow
jihoonson 7a67475
Address comments
jihoonson 766cbce
ConcurrentGrouperTest cleanup
jihoonson b63b37e
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson 39cf1f2
add thread number configuration for parallel combining
jihoonson 0723960
improve doc
jihoonson 65078c3
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson 78df53d
address comments
jihoonson 834001a
Merge branch 'master' of https://github.com/druid-io/druid into strea…
jihoonson 101391b
fix build
jihoonson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
common/src/main/java/io/druid/common/utils/IntArrayUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. Metamarkets 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 io.druid.common.utils; | ||
|
||
public class IntArrayUtils | ||
{ | ||
/** | ||
* Inverses the values of the given array with their indexes. | ||
* For example, the result for [2, 0, 1] is [1, 2, 0] because | ||
* | ||
* a[0]: 2 => a[2]: 0 | ||
* a[1]: 0 => a[0]: 1 | ||
* a[2]: 1 => a[1]: 2 | ||
*/ | ||
public static void inverse(int[] a) | ||
{ | ||
for (int i = 0; i < a.length; i++) { | ||
if (a[i] >= 0) { | ||
inverseLoop(a, i); | ||
} | ||
} | ||
|
||
for (int i = 0; i < a.length; i++) { | ||
a[i] = ~a[i]; | ||
} | ||
} | ||
|
||
private static void inverseLoop(int[] a, int startValue) | ||
{ | ||
final int startIndex = a[startValue]; | ||
|
||
int nextIndex = startIndex; | ||
int nextValue = startValue; | ||
|
||
do { | ||
final int curIndex = nextIndex; | ||
final int curValue = nextValue; | ||
|
||
nextValue = curIndex; | ||
nextIndex = a[curIndex]; | ||
|
||
a[curIndex] = ~curValue; | ||
} while (nextIndex != startIndex); | ||
} | ||
|
||
private IntArrayUtils() {} | ||
} |
54 changes: 54 additions & 0 deletions
54
common/src/test/java/io/druid/common/utils/IntArrayUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. Metamarkets 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 io.druid.common.utils; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Random; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
public class IntArrayUtilsTest | ||
{ | ||
@Test | ||
public void testInverse() | ||
{ | ||
final int numVals = 10000; | ||
final Random random = new Random(System.currentTimeMillis()); | ||
final int[] inverted = new int[numVals]; | ||
final int[] original = new int[numVals]; | ||
|
||
final List<Integer> ints = IntStream.range(0, numVals).boxed().collect(Collectors.toList()); | ||
Collections.shuffle(ints, random); | ||
|
||
for (int i = 0; i < numVals; i++) { | ||
inverted[i] = ints.get(i); | ||
original[i] = inverted[i]; | ||
} | ||
IntArrayUtils.inverse(inverted); | ||
|
||
for (int i = 0; i < numVals; i++) { | ||
Assert.assertEquals(i, inverted[original[i]]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How a user could "see too many collisions"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is not easy for users. I think currently the only possible way is method-level profiling. I think we need to provide some metrics for hash table collisions and growths.