forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38e9a79
commit 533a263
Showing
5 changed files
with
255 additions
and
108 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
processing/src/main/java/io/druid/query/ParallelQueryRunner.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,14 @@ | ||
package io.druid.query; | ||
|
||
public interface ParallelQueryRunner<T> extends QueryRunner<T> | ||
{ | ||
|
||
/** | ||
* accumulator passed should be thread safe | ||
*/ | ||
<OutType> OutType runAndAccumulate( | ||
Query<T> query, | ||
OutType outType, | ||
com.metamx.common.guava.Accumulator<OutType, T> outTypeTAccumulator | ||
); | ||
} |
56 changes: 56 additions & 0 deletions
56
processing/src/main/java/io/druid/query/aggregation/Aggregators.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,56 @@ | ||
package io.druid.query.aggregation; | ||
|
||
public class Aggregators | ||
{ | ||
|
||
public static Aggregator synchronizedAggregator(Aggregator aggregator){ | ||
return new SynchronizedAggregator(aggregator); | ||
} | ||
|
||
private static class SynchronizedAggregator implements Aggregator | ||
{ | ||
|
||
private final Aggregator delegate; | ||
|
||
SynchronizedAggregator(Aggregator delegate) | ||
{ | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public synchronized void aggregate() | ||
{ | ||
delegate.aggregate(); | ||
} | ||
|
||
@Override | ||
public synchronized void reset() | ||
{ | ||
delegate.reset(); | ||
} | ||
|
||
@Override | ||
public synchronized Object get() | ||
{ | ||
return delegate.get(); | ||
} | ||
|
||
@Override | ||
public synchronized float getFloat() | ||
{ | ||
return delegate.getFloat(); | ||
} | ||
|
||
@Override | ||
public synchronized String getName() | ||
{ | ||
return delegate.getName(); | ||
} | ||
|
||
@Override | ||
public synchronized void close() | ||
{ | ||
delegate.close(); | ||
} | ||
} | ||
} |
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.