id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
127,700
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/cache/CacheKeyBuilder.java
CacheKeyBuilder.appendCacheablesIgnoringOrder
public CacheKeyBuilder appendCacheablesIgnoringOrder(Collection<? extends Cacheable> input) { appendItem(CACHEABLE_LIST_KEY, cacheableCollectionToByteArray(input, false)); return this; }
java
public CacheKeyBuilder appendCacheablesIgnoringOrder(Collection<? extends Cacheable> input) { appendItem(CACHEABLE_LIST_KEY, cacheableCollectionToByteArray(input, false)); return this; }
[ "public", "CacheKeyBuilder", "appendCacheablesIgnoringOrder", "(", "Collection", "<", "?", "extends", "Cacheable", ">", "input", ")", "{", "appendItem", "(", "CACHEABLE_LIST_KEY", ",", "cacheableCollectionToByteArray", "(", "input", ",", "false", ")", ")", ";", "ret...
Add a collection of Cacheables to the cache key. Cacheables in the collection are sorted by their byte representation and concatenated without any separator. @param input a collection of Cacheables to be included in the cache key @return this instance
[ "Add", "a", "collection", "of", "Cacheables", "to", "the", "cache", "key", ".", "Cacheables", "in", "the", "collection", "are", "sorted", "by", "their", "byte", "representation", "and", "concatenated", "without", "any", "separator", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/cache/CacheKeyBuilder.java#L305-L309
127,701
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/table/RowSignature.java
RowSignature.getRelDataType
public RelDataType getRelDataType(final RelDataTypeFactory typeFactory) { final RelDataTypeFactory.Builder builder = typeFactory.builder(); for (final String columnName : columnNames) { final ValueType columnType = getColumnType(columnName); final RelDataType type; if (ColumnHolder.TIME_COL...
java
public RelDataType getRelDataType(final RelDataTypeFactory typeFactory) { final RelDataTypeFactory.Builder builder = typeFactory.builder(); for (final String columnName : columnNames) { final ValueType columnType = getColumnType(columnName); final RelDataType type; if (ColumnHolder.TIME_COL...
[ "public", "RelDataType", "getRelDataType", "(", "final", "RelDataTypeFactory", "typeFactory", ")", "{", "final", "RelDataTypeFactory", ".", "Builder", "builder", "=", "typeFactory", ".", "builder", "(", ")", ";", "for", "(", "final", "String", "columnName", ":", ...
Returns a Calcite RelDataType corresponding to this row signature. @param typeFactory factory for type construction @return Calcite row type
[ "Returns", "a", "Calcite", "RelDataType", "corresponding", "to", "this", "row", "signature", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/table/RowSignature.java#L146-L183
127,702
apache/incubator-druid
core/src/main/java/org/apache/druid/common/utils/UUIDUtils.java
UUIDUtils.generateUuid
public static String generateUuid(String... extraData) { String extra = null; if (extraData != null && extraData.length > 0) { final ArrayList<String> extraStrings = new ArrayList<>(extraData.length); for (String extraString : extraData) { if (!Strings.isNullOrEmpty(extraString)) { ...
java
public static String generateUuid(String... extraData) { String extra = null; if (extraData != null && extraData.length > 0) { final ArrayList<String> extraStrings = new ArrayList<>(extraData.length); for (String extraString : extraData) { if (!Strings.isNullOrEmpty(extraString)) { ...
[ "public", "static", "String", "generateUuid", "(", "String", "...", "extraData", ")", "{", "String", "extra", "=", "null", ";", "if", "(", "extraData", "!=", "null", "&&", "extraData", ".", "length", ">", "0", ")", "{", "final", "ArrayList", "<", "String...
Generates a universally unique identifier. @param extraData Extra data which often takes the form of debugging information @return A string which is a universally unique id (as determined by java.util.UUID) with extra data. It does not conform to a UUID variant standard.
[ "Generates", "a", "universally", "unique", "identifier", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/common/utils/UUIDUtils.java#L43-L60
127,703
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/Queries.java
Queries.prepareAggregations
public static List<PostAggregator> prepareAggregations( List<String> otherOutputNames, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(otherOutputNames, "otherOutputNames cannot be null"); Preconditions.checkNotNull(aggFactories, "aggregat...
java
public static List<PostAggregator> prepareAggregations( List<String> otherOutputNames, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(otherOutputNames, "otherOutputNames cannot be null"); Preconditions.checkNotNull(aggFactories, "aggregat...
[ "public", "static", "List", "<", "PostAggregator", ">", "prepareAggregations", "(", "List", "<", "String", ">", "otherOutputNames", ",", "List", "<", "AggregatorFactory", ">", "aggFactories", ",", "List", "<", "PostAggregator", ">", "postAggs", ")", "{", "Precon...
Returns decorated post-aggregators, based on original un-decorated post-aggregators. In addition, this method also verifies that there are no output name collisions, and that all of the post-aggregators' required input fields are present. @param otherOutputNames names of fields that will appear in the same output name...
[ "Returns", "decorated", "post", "-", "aggregators", "based", "on", "original", "un", "-", "decorated", "post", "-", "aggregators", ".", "In", "addition", "this", "method", "also", "verifies", "that", "there", "are", "no", "output", "name", "collisions", "and",...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/Queries.java#L90-L132
127,704
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/scan/ScanQueryEngine.java
ScanQueryEngine.calculateLimit
private long calculateLimit(ScanQuery query, Map<String, Object> responseContext) { if (query.getOrder().equals(ScanQuery.Order.NONE)) { return query.getLimit() - (long) responseContext.get(ScanQueryRunnerFactory.CTX_COUNT); } return query.getLimit(); }
java
private long calculateLimit(ScanQuery query, Map<String, Object> responseContext) { if (query.getOrder().equals(ScanQuery.Order.NONE)) { return query.getLimit() - (long) responseContext.get(ScanQueryRunnerFactory.CTX_COUNT); } return query.getLimit(); }
[ "private", "long", "calculateLimit", "(", "ScanQuery", "query", ",", "Map", "<", "String", ",", "Object", ">", "responseContext", ")", "{", "if", "(", "query", ".", "getOrder", "(", ")", ".", "equals", "(", "ScanQuery", ".", "Order", ".", "NONE", ")", ...
If we're performing time-ordering, we want to scan through the first `limit` rows in each segment ignoring the number of rows already counted on other segments.
[ "If", "we", "re", "performing", "time", "-", "ordering", "we", "want", "to", "scan", "through", "the", "first", "limit", "rows", "in", "each", "segment", "ignoring", "the", "number", "of", "rows", "already", "counted", "on", "other", "segments", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/scan/ScanQueryEngine.java#L265-L271
127,705
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/data/ArrayBasedIndexedInts.java
ArrayBasedIndexedInts.setValues
public void setValues(int[] values, int size) { if (size < 0 || size > values.length) { throw new IAE("Size[%d] should be between 0 and %d", size, values.length); } ensureSize(size); System.arraycopy(values, 0, expansion, 0, size); this.size = size; }
java
public void setValues(int[] values, int size) { if (size < 0 || size > values.length) { throw new IAE("Size[%d] should be between 0 and %d", size, values.length); } ensureSize(size); System.arraycopy(values, 0, expansion, 0, size); this.size = size; }
[ "public", "void", "setValues", "(", "int", "[", "]", "values", ",", "int", "size", ")", "{", "if", "(", "size", "<", "0", "||", "size", ">", "values", ".", "length", ")", "{", "throw", "new", "IAE", "(", "\"Size[%d] should be between 0 and %d\"", ",", ...
Sets the values from the given array. The given values array is not reused and not prone to be mutated later. Instead, the values from this array are copied into an array which is internal to ArrayBasedIndexedInts.
[ "Sets", "the", "values", "from", "the", "given", "array", ".", "The", "given", "values", "array", "is", "not", "reused", "and", "not", "prone", "to", "be", "mutated", "later", ".", "Instead", "the", "values", "from", "this", "array", "are", "copied", "in...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/data/ArrayBasedIndexedInts.java#L66-L74
127,706
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java
CostBalancerStrategy.computeJointSegmentsCost
public static double computeJointSegmentsCost(final DataSegment segmentA, final DataSegment segmentB) { final Interval intervalA = segmentA.getInterval(); final Interval intervalB = segmentB.getInterval(); final double t0 = intervalA.getStartMillis(); final double t1 = (intervalA.getEndMillis() - t0)...
java
public static double computeJointSegmentsCost(final DataSegment segmentA, final DataSegment segmentB) { final Interval intervalA = segmentA.getInterval(); final Interval intervalB = segmentB.getInterval(); final double t0 = intervalA.getStartMillis(); final double t1 = (intervalA.getEndMillis() - t0)...
[ "public", "static", "double", "computeJointSegmentsCost", "(", "final", "DataSegment", "segmentA", ",", "final", "DataSegment", "segmentB", ")", "{", "final", "Interval", "intervalA", "=", "segmentA", ".", "getInterval", "(", ")", ";", "final", "Interval", "interv...
This defines the unnormalized cost function between two segments. See https://github.com/apache/incubator-druid/pull/2972 for more details about the cost function. intervalCost: segments close together are more likely to be queried together multiplier: if two segments belong to the same data source, they are more li...
[ "This", "defines", "the", "unnormalized", "cost", "function", "between", "two", "segments", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java#L67-L81
127,707
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java
CostBalancerStrategy.intervalCost
public static double intervalCost(double x1, double y0, double y1) { if (x1 == 0 || y1 == y0) { return 0; } // cost(X, Y) = cost(Y, X), so we swap X and Y to // have x_0 <= y_0 and simplify the calculations below if (y0 < 0) { // swap X and Y double tmp = x1; x1 = y1 - y0;...
java
public static double intervalCost(double x1, double y0, double y1) { if (x1 == 0 || y1 == y0) { return 0; } // cost(X, Y) = cost(Y, X), so we swap X and Y to // have x_0 <= y_0 and simplify the calculations below if (y0 < 0) { // swap X and Y double tmp = x1; x1 = y1 - y0;...
[ "public", "static", "double", "intervalCost", "(", "double", "x1", ",", "double", "y0", ",", "double", "y1", ")", "{", "if", "(", "x1", "==", "0", "||", "y1", "==", "y0", ")", "{", "return", "0", ";", "}", "// cost(X, Y) = cost(Y, X), so we swap X and Y to...
Computes the joint cost of two intervals X = [x_0 = 0, x_1) and Y = [y_0, y_1) cost(X, Y) = \int_{x_0}^{x_1} \int_{y_0}^{y_1} e^{-\lambda |x-y|}dxdy $$ lambda = 1 in this particular implementation Other values of lambda can be calculated by multiplying inputs by lambda and multiplying the result by 1 / lambda ^ 2 I...
[ "Computes", "the", "joint", "cost", "of", "two", "intervals", "X", "=", "[", "x_0", "=", "0", "x_1", ")", "and", "Y", "=", "[", "y_0", "y_1", ")" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java#L102-L177
127,708
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java
CostBalancerStrategy.calculateInitialTotalCost
public double calculateInitialTotalCost(final List<ServerHolder> serverHolders) { double cost = 0; for (ServerHolder server : serverHolders) { Iterable<DataSegment> segments = server.getServer().getLazyAllSegments(); for (DataSegment s : segments) { cost += computeJointSegmentsCost(s, segm...
java
public double calculateInitialTotalCost(final List<ServerHolder> serverHolders) { double cost = 0; for (ServerHolder server : serverHolders) { Iterable<DataSegment> segments = server.getServer().getLazyAllSegments(); for (DataSegment s : segments) { cost += computeJointSegmentsCost(s, segm...
[ "public", "double", "calculateInitialTotalCost", "(", "final", "List", "<", "ServerHolder", ">", "serverHolders", ")", "{", "double", "cost", "=", "0", ";", "for", "(", "ServerHolder", "server", ":", "serverHolders", ")", "{", "Iterable", "<", "DataSegment", "...
Calculates the initial cost of the Druid segment configuration. @param serverHolders A list of ServerHolders for a particular tier. @return The initial cost of the Druid tier.
[ "Calculates", "the", "initial", "cost", "of", "the", "Druid", "segment", "configuration", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java#L257-L267
127,709
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java
CostBalancerStrategy.chooseBestServer
protected Pair<Double, ServerHolder> chooseBestServer( final DataSegment proposalSegment, final Iterable<ServerHolder> serverHolders, final boolean includeCurrentServer ) { Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null); List<ListenableFuture<Pair<Double, ...
java
protected Pair<Double, ServerHolder> chooseBestServer( final DataSegment proposalSegment, final Iterable<ServerHolder> serverHolders, final boolean includeCurrentServer ) { Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null); List<ListenableFuture<Pair<Double, ...
[ "protected", "Pair", "<", "Double", ",", "ServerHolder", ">", "chooseBestServer", "(", "final", "DataSegment", "proposalSegment", ",", "final", "Iterable", "<", "ServerHolder", ">", "serverHolders", ",", "final", "boolean", "includeCurrentServer", ")", "{", "Pair", ...
For assignment, we want to move to the lowest cost server that isn't already serving the segment. @param proposalSegment A DataSegment that we are proposing to move. @param serverHolders An iterable of ServerHolders for a particular tier. @return A ServerHolder with the new home for a segment.
[ "For", "assignment", "we", "want", "to", "move", "to", "the", "lowest", "cost", "server", "that", "isn", "t", "already", "serving", "the", "segment", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java#L358-L396
127,710
apache/incubator-druid
server/src/main/java/org/apache/druid/client/cache/MemcachedCustomConnectionFactoryBuilder.java
MemcachedCustomConnectionFactoryBuilder.build
@Override public ConnectionFactory build() { return new DefaultConnectionFactory() { @Override public NodeLocator createLocator(List<MemcachedNode> nodes) { switch (locator) { case ARRAY_MOD: return new ArrayModNodeLocator(nodes, getHashAlg()); case ...
java
@Override public ConnectionFactory build() { return new DefaultConnectionFactory() { @Override public NodeLocator createLocator(List<MemcachedNode> nodes) { switch (locator) { case ARRAY_MOD: return new ArrayModNodeLocator(nodes, getHashAlg()); case ...
[ "@", "Override", "public", "ConnectionFactory", "build", "(", ")", "{", "return", "new", "DefaultConnectionFactory", "(", ")", "{", "@", "Override", "public", "NodeLocator", "createLocator", "(", "List", "<", "MemcachedNode", ">", "nodes", ")", "{", "switch", ...
borrowed from ConnectionFactoryBuilder to allow setting number of repetitions for KetamaNodeLocator
[ "borrowed", "from", "ConnectionFactoryBuilder", "to", "allow", "setting", "number", "of", "repetitions", "for", "KetamaNodeLocator" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/cache/MemcachedCustomConnectionFactoryBuilder.java#L56-L217
127,711
apache/incubator-druid
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/supervisor/KinesisSupervisor.java
KinesisSupervisor.getLagPerPartition
@Override protected Map<String, String> getLagPerPartition(Map<String, String> currentOffsets) { return ImmutableMap.of(); }
java
@Override protected Map<String, String> getLagPerPartition(Map<String, String> currentOffsets) { return ImmutableMap.of(); }
[ "@", "Override", "protected", "Map", "<", "String", ",", "String", ">", "getLagPerPartition", "(", "Map", "<", "String", ",", "String", ">", "currentOffsets", ")", "{", "return", "ImmutableMap", ".", "of", "(", ")", ";", "}" ]
not yet supported, will be implemented in the future
[ "not", "yet", "supported", "will", "be", "implemented", "in", "the", "future" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/supervisor/KinesisSupervisor.java#L255-L259
127,712
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java
ByteBufferMinMaxOffsetHeap.findMinGrandChild
private int findMinGrandChild(Comparator comparator, int index) { int leftChildIndex = getLeftChildIndex(index); if (leftChildIndex < 0) { return -1; } return findMin(comparator, getLeftChildIndex(leftChildIndex), 4); }
java
private int findMinGrandChild(Comparator comparator, int index) { int leftChildIndex = getLeftChildIndex(index); if (leftChildIndex < 0) { return -1; } return findMin(comparator, getLeftChildIndex(leftChildIndex), 4); }
[ "private", "int", "findMinGrandChild", "(", "Comparator", "comparator", ",", "int", "index", ")", "{", "int", "leftChildIndex", "=", "getLeftChildIndex", "(", "index", ")", ";", "if", "(", "leftChildIndex", "<", "0", ")", "{", "return", "-", "1", ";", "}",...
Returns the minimum grand child or -1 if no grand child exists.
[ "Returns", "the", "minimum", "grand", "child", "or", "-", "1", "if", "no", "grand", "child", "exists", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java#L383-L390
127,713
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java
ByteBufferMinMaxOffsetHeap.findMaxElementIndex
private int findMaxElementIndex() { switch (heapSize) { case 1: return 0; // The lone element in the queue is the maximum. case 2: return 1; // The lone element in the maxHeap is the maximum. default: // The max element must sit on the first level of the maxHeap. It is ...
java
private int findMaxElementIndex() { switch (heapSize) { case 1: return 0; // The lone element in the queue is the maximum. case 2: return 1; // The lone element in the maxHeap is the maximum. default: // The max element must sit on the first level of the maxHeap. It is ...
[ "private", "int", "findMaxElementIndex", "(", ")", "{", "switch", "(", "heapSize", ")", "{", "case", "1", ":", "return", "0", ";", "// The lone element in the queue is the maximum.", "case", "2", ":", "return", "1", ";", "// The lone element in the maxHeap is the maxi...
Returns the index of the max element.
[ "Returns", "the", "index", "of", "the", "max", "element", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java#L421-L435
127,714
apache/incubator-druid
server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java
DiscoveryModule.register
public static void register(Binder binder, Annotation annotation) { registerKey(binder, Key.get(new TypeLiteral<DruidNode>(){}, annotation)); }
java
public static void register(Binder binder, Annotation annotation) { registerKey(binder, Key.get(new TypeLiteral<DruidNode>(){}, annotation)); }
[ "public", "static", "void", "register", "(", "Binder", "binder", ",", "Annotation", "annotation", ")", "{", "registerKey", "(", "binder", ",", "Key", ".", "get", "(", "new", "TypeLiteral", "<", "DruidNode", ">", "(", ")", "{", "}", ",", "annotation", ")"...
Requests that the annotated DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class, annotation)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle @param...
[ "Requests", "that", "the", "annotated", "DruidNode", "instance", "be", "injected", "and", "published", "as", "part", "of", "the", "lifecycle", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java#L112-L115
127,715
apache/incubator-druid
server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java
DiscoveryModule.registerKey
public static void registerKey(Binder binder, Key<DruidNode> key) { DruidBinders.discoveryAnnouncementBinder(binder).addBinding().toInstance(new KeyHolder<>(key)); LifecycleModule.register(binder, ServiceAnnouncer.class); }
java
public static void registerKey(Binder binder, Key<DruidNode> key) { DruidBinders.discoveryAnnouncementBinder(binder).addBinding().toInstance(new KeyHolder<>(key)); LifecycleModule.register(binder, ServiceAnnouncer.class); }
[ "public", "static", "void", "registerKey", "(", "Binder", "binder", ",", "Key", "<", "DruidNode", ">", "key", ")", "{", "DruidBinders", ".", "discoveryAnnouncementBinder", "(", "binder", ")", ".", "addBinding", "(", ")", ".", "toInstance", "(", "new", "KeyHo...
Requests that the keyed DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class, annotation)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle @param bin...
[ "Requests", "that", "the", "keyed", "DruidNode", "instance", "be", "injected", "and", "published", "as", "part", "of", "the", "lifecycle", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java#L142-L146
127,716
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskStorageQueryAdapter.java
TaskStorageQueryAdapter.getInsertedSegments
@Deprecated public Set<DataSegment> getInsertedSegments(final String taskid) { final Set<DataSegment> segments = new HashSet<>(); for (final TaskAction action : storage.getAuditLogs(taskid)) { if (action instanceof SegmentInsertAction) { segments.addAll(((SegmentInsertAction) action).getSegmen...
java
@Deprecated public Set<DataSegment> getInsertedSegments(final String taskid) { final Set<DataSegment> segments = new HashSet<>(); for (final TaskAction action : storage.getAuditLogs(taskid)) { if (action instanceof SegmentInsertAction) { segments.addAll(((SegmentInsertAction) action).getSegmen...
[ "@", "Deprecated", "public", "Set", "<", "DataSegment", ">", "getInsertedSegments", "(", "final", "String", "taskid", ")", "{", "final", "Set", "<", "DataSegment", ">", "segments", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "final", "TaskActio...
Returns all segments created by this task. This method is useful when you want to figure out all of the things a single task spawned. It does pose issues with the result set perhaps growing boundlessly and we do not do anything to protect against that. Use at your own risk and know that at some point, we might adjus...
[ "Returns", "all", "segments", "created", "by", "this", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskStorageQueryAdapter.java#L96-L108
127,717
apache/incubator-druid
core/src/main/java/org/apache/druid/data/input/Rows.java
Rows.objectToStrings
public static List<String> objectToStrings(final Object inputValue) { if (inputValue == null) { return Collections.emptyList(); } else if (inputValue instanceof List) { // guava's toString function fails on null objects, so please do not use it return ((List<?>) inputValue).stream().map(Stri...
java
public static List<String> objectToStrings(final Object inputValue) { if (inputValue == null) { return Collections.emptyList(); } else if (inputValue instanceof List) { // guava's toString function fails on null objects, so please do not use it return ((List<?>) inputValue).stream().map(Stri...
[ "public", "static", "List", "<", "String", ">", "objectToStrings", "(", "final", "Object", "inputValue", ")", "{", "if", "(", "inputValue", "==", "null", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "else", "if", "(", "inputVa...
Convert an object to a list of strings.
[ "Convert", "an", "object", "to", "a", "list", "of", "strings", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/data/input/Rows.java#L62-L117
127,718
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java
ParallelCombiner.computeRequiredBufferNum
private int computeRequiredBufferNum(int numChildNodes, int combineDegree) { // numChildrenForLastNode used to determine that the last node is needed for the current level. // Please see buildCombineTree() for more details. final int numChildrenForLastNode = numChildNodes % combineDegree; final int nu...
java
private int computeRequiredBufferNum(int numChildNodes, int combineDegree) { // numChildrenForLastNode used to determine that the last node is needed for the current level. // Please see buildCombineTree() for more details. final int numChildrenForLastNode = numChildNodes % combineDegree; final int nu...
[ "private", "int", "computeRequiredBufferNum", "(", "int", "numChildNodes", ",", "int", "combineDegree", ")", "{", "// numChildrenForLastNode used to determine that the last node is needed for the current level.", "// Please see buildCombineTree() for more details.", "final", "int", "nu...
Recursively compute the number of required buffers for a combining tree in a bottom-up manner. Since each node of the combining tree represents a combining task and each combining task requires one buffer, the number of required buffers is the number of nodes of the combining tree. @param numChildNodes number of chil...
[ "Recursively", "compute", "the", "number", "of", "required", "buffers", "for", "a", "combining", "tree", "in", "a", "bottom", "-", "up", "manner", ".", "Since", "each", "node", "of", "the", "combining", "tree", "represents", "a", "combining", "task", "and", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java#L282-L296
127,719
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java
ParallelCombiner.buildCombineTree
private Pair<List<CloseableIterator<Entry<KeyType>>>, List<Future>> buildCombineTree( List<? extends CloseableIterator<Entry<KeyType>>> childIterators, Supplier<ByteBuffer> bufferSupplier, AggregatorFactory[] combiningFactories, int combineDegree, List<String> dictionary ) { final ...
java
private Pair<List<CloseableIterator<Entry<KeyType>>>, List<Future>> buildCombineTree( List<? extends CloseableIterator<Entry<KeyType>>> childIterators, Supplier<ByteBuffer> bufferSupplier, AggregatorFactory[] combiningFactories, int combineDegree, List<String> dictionary ) { final ...
[ "private", "Pair", "<", "List", "<", "CloseableIterator", "<", "Entry", "<", "KeyType", ">", ">", ">", ",", "List", "<", "Future", ">", ">", "buildCombineTree", "(", "List", "<", "?", "extends", "CloseableIterator", "<", "Entry", "<", "KeyType", ">", ">"...
Recursively build a combining tree in a bottom-up manner. Each node of the tree is a task that combines input iterators asynchronously. @param childIterators all iterators of the child level @param bufferSupplier combining buffer supplier @param combiningFactories array of combining aggregator factories @para...
[ "Recursively", "build", "a", "combining", "tree", "in", "a", "bottom", "-", "up", "manner", ".", "Each", "node", "of", "the", "tree", "is", "a", "task", "that", "combines", "input", "iterators", "asynchronously", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java#L311-L377
127,720
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/monomorphicprocessing/SpecializationState.java
SpecializationState.getSpecializedOrDefault
public final T getSpecializedOrDefault(T defaultInstance) { T specialized = getSpecialized(); return specialized != null ? specialized : defaultInstance; }
java
public final T getSpecializedOrDefault(T defaultInstance) { T specialized = getSpecialized(); return specialized != null ? specialized : defaultInstance; }
[ "public", "final", "T", "getSpecializedOrDefault", "(", "T", "defaultInstance", ")", "{", "T", "specialized", "=", "getSpecialized", "(", ")", ";", "return", "specialized", "!=", "null", "?", "specialized", ":", "defaultInstance", ";", "}" ]
Returns an instance of specialized version of query processing algorithm, if available, defaultInstance otherwise.
[ "Returns", "an", "instance", "of", "specialized", "version", "of", "query", "processing", "algorithm", "if", "available", "defaultInstance", "otherwise", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/monomorphicprocessing/SpecializationState.java#L39-L43
127,721
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/incremental/SpatialDimensionRowTransformer.java
SpatialDimensionRowTransformer.decode
public static float[] decode(final String encodedCoordinate) { if (encodedCoordinate == null) { return null; } final ImmutableList<String> parts = ImmutableList.copyOf(SPLITTER.split(encodedCoordinate)); final float[] coordinate = new float[parts.size()]; for (int i = 0; i < coordinate.len...
java
public static float[] decode(final String encodedCoordinate) { if (encodedCoordinate == null) { return null; } final ImmutableList<String> parts = ImmutableList.copyOf(SPLITTER.split(encodedCoordinate)); final float[] coordinate = new float[parts.size()]; for (int i = 0; i < coordinate.len...
[ "public", "static", "float", "[", "]", "decode", "(", "final", "String", "encodedCoordinate", ")", "{", "if", "(", "encodedCoordinate", "==", "null", ")", "{", "return", "null", ";", "}", "final", "ImmutableList", "<", "String", ">", "parts", "=", "Immutab...
Decodes encodedCoordinate. @param encodedCoordinate encoded coordinate @return decoded coordinate, or null if it could not be decoded
[ "Decodes", "encodedCoordinate", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/incremental/SpatialDimensionRowTransformer.java#L228-L247
127,722
apache/incubator-druid
server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
SQLMetadataSegmentManager.getDataSegmentsOverlappingInterval
private List<Pair<DataSegment, Boolean>> getDataSegmentsOverlappingInterval( final String dataSource, final Interval interval ) { return connector.inReadOnlyTransaction( (handle, status) -> handle.createQuery( StringUtils.format( "SELECT used, payload FROM %1$s WH...
java
private List<Pair<DataSegment, Boolean>> getDataSegmentsOverlappingInterval( final String dataSource, final Interval interval ) { return connector.inReadOnlyTransaction( (handle, status) -> handle.createQuery( StringUtils.format( "SELECT used, payload FROM %1$s WH...
[ "private", "List", "<", "Pair", "<", "DataSegment", ",", "Boolean", ">", ">", "getDataSegmentsOverlappingInterval", "(", "final", "String", "dataSource", ",", "final", "Interval", "interval", ")", "{", "return", "connector", ".", "inReadOnlyTransaction", "(", "(",...
Gets a list of all datasegments that overlap the provided interval along with thier used status.
[ "Gets", "a", "list", "of", "all", "datasegments", "that", "overlap", "the", "provided", "interval", "along", "with", "thier", "used", "status", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java#L240-L260
127,723
apache/incubator-druid
server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
SQLMetadataSegmentManager.buildVersionedIntervalTimeline
private VersionedIntervalTimeline<String, DataSegment> buildVersionedIntervalTimeline( final String dataSource, final Collection<Interval> intervals, final Handle handle ) { return VersionedIntervalTimeline.forSegments(intervals .stream() .flatMap(interval -> handle.createQuery...
java
private VersionedIntervalTimeline<String, DataSegment> buildVersionedIntervalTimeline( final String dataSource, final Collection<Interval> intervals, final Handle handle ) { return VersionedIntervalTimeline.forSegments(intervals .stream() .flatMap(interval -> handle.createQuery...
[ "private", "VersionedIntervalTimeline", "<", "String", ",", "DataSegment", ">", "buildVersionedIntervalTimeline", "(", "final", "String", "dataSource", ",", "final", "Collection", "<", "Interval", ">", "intervals", ",", "final", "Handle", "handle", ")", "{", "return...
Builds a VersionedIntervalTimeline containing used segments that overlap the intervals passed.
[ "Builds", "a", "VersionedIntervalTimeline", "containing", "used", "segments", "that", "overlap", "the", "intervals", "passed", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java#L289-L321
127,724
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferHashTable.java
ByteBufferHashTable.findBucket
protected int findBucket( final boolean allowNewBucket, final int buckets, final ByteBuffer targetTableBuffer, final ByteBuffer keyBuffer, final int keyHash ) { // startBucket will never be negative since keyHash is always positive (see Groupers.hash) final int startBucket = ke...
java
protected int findBucket( final boolean allowNewBucket, final int buckets, final ByteBuffer targetTableBuffer, final ByteBuffer keyBuffer, final int keyHash ) { // startBucket will never be negative since keyHash is always positive (see Groupers.hash) final int startBucket = ke...
[ "protected", "int", "findBucket", "(", "final", "boolean", "allowNewBucket", ",", "final", "int", "buckets", ",", "final", "ByteBuffer", "targetTableBuffer", ",", "final", "ByteBuffer", "keyBuffer", ",", "final", "int", "keyHash", ")", "{", "// startBucket will neve...
Finds the bucket into which we should insert a key. @param keyBuffer key, must have exactly keySize bytes remaining. Will not be modified. @param targetTableBuffer Need selectable buffer, since when resizing hash table, findBucket() is used on the newly allocated table buffer @return bucket index for this key, or -1 ...
[ "Finds", "the", "bucket", "into", "which", "we", "should", "insert", "a", "key", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferHashTable.java#L286-L327
127,725
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.lock
public LockResult lock( final TaskLockType lockType, final Task task, final Interval interval ) throws InterruptedException { giant.lockInterruptibly(); try { LockResult lockResult; while (!(lockResult = tryLock(lockType, task, interval)).isOk()) { if (lockResult.isRevo...
java
public LockResult lock( final TaskLockType lockType, final Task task, final Interval interval ) throws InterruptedException { giant.lockInterruptibly(); try { LockResult lockResult; while (!(lockResult = tryLock(lockType, task, interval)).isOk()) { if (lockResult.isRevo...
[ "public", "LockResult", "lock", "(", "final", "TaskLockType", "lockType", ",", "final", "Task", "task", ",", "final", "Interval", "interval", ")", "throws", "InterruptedException", "{", "giant", ".", "lockInterruptibly", "(", ")", ";", "try", "{", "LockResult", ...
Acquires a lock on behalf of a task. Blocks until the lock is acquired. @param lockType lock type @param task task to acquire lock for @param interval interval to lock @return {@link LockResult} containing a new or an existing lock if succeeded. Otherwise, {@link LockResult} with a {@link LockResult#revoked} fla...
[ "Acquires", "a", "lock", "on", "behalf", "of", "a", "task", ".", "Blocks", "until", "the", "lock", "is", "acquired", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L203-L223
127,726
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.lock
public LockResult lock( final TaskLockType lockType, final Task task, final Interval interval, long timeoutMs ) throws InterruptedException { long nanos = TimeUnit.MILLISECONDS.toNanos(timeoutMs); giant.lockInterruptibly(); try { LockResult lockResult; while (!(lockRe...
java
public LockResult lock( final TaskLockType lockType, final Task task, final Interval interval, long timeoutMs ) throws InterruptedException { long nanos = TimeUnit.MILLISECONDS.toNanos(timeoutMs); giant.lockInterruptibly(); try { LockResult lockResult; while (!(lockRe...
[ "public", "LockResult", "lock", "(", "final", "TaskLockType", "lockType", ",", "final", "Task", "task", ",", "final", "Interval", "interval", ",", "long", "timeoutMs", ")", "throws", "InterruptedException", "{", "long", "nanos", "=", "TimeUnit", ".", "MILLISECON...
Acquires a lock on behalf of a task, waiting up to the specified wait time if necessary. @param lockType lock type @param task task to acquire a lock for @param interval interval to lock @param timeoutMs maximum time to wait @return {@link LockResult} containing a new or an existing lock if succeeded. Otherwis...
[ "Acquires", "a", "lock", "on", "behalf", "of", "a", "task", "waiting", "up", "to", "the", "specified", "wait", "time", "if", "necessary", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L238-L260
127,727
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.tryLock
public LockResult tryLock( final TaskLockType lockType, final Task task, final Interval interval ) { giant.lock(); try { if (!activeTasks.contains(task.getId())) { throw new ISE("Unable to grant lock to inactive Task [%s]", task.getId()); } Preconditions.checkArg...
java
public LockResult tryLock( final TaskLockType lockType, final Task task, final Interval interval ) { giant.lock(); try { if (!activeTasks.contains(task.getId())) { throw new ISE("Unable to grant lock to inactive Task [%s]", task.getId()); } Preconditions.checkArg...
[ "public", "LockResult", "tryLock", "(", "final", "TaskLockType", "lockType", ",", "final", "Task", "task", ",", "final", "Interval", "interval", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "!", "activeTasks", ".", "contains", "(...
Attempt to acquire a lock for a task, without removing it from the queue. Can safely be called multiple times on the same task until the lock is preempted. @param lockType type of lock to be acquired @param task task that wants a lock @param interval interval to lock @return {@link LockResult} containing a new or...
[ "Attempt", "to", "acquire", "a", "lock", "for", "a", "task", "without", "removing", "it", "from", "the", "queue", ".", "Can", "safely", "be", "called", "multiple", "times", "on", "the", "same", "task", "until", "the", "lock", "is", "preempted", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L275-L322
127,728
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.doInCriticalSection
public <T> T doInCriticalSection(Task task, List<Interval> intervals, CriticalAction<T> action) throws Exception { giant.lock(); try { return action.perform(isTaskLocksValid(task, intervals)); } finally { giant.unlock(); } }
java
public <T> T doInCriticalSection(Task task, List<Interval> intervals, CriticalAction<T> action) throws Exception { giant.lock(); try { return action.perform(isTaskLocksValid(task, intervals)); } finally { giant.unlock(); } }
[ "public", "<", "T", ">", "T", "doInCriticalSection", "(", "Task", "task", ",", "List", "<", "Interval", ">", "intervals", ",", "CriticalAction", "<", "T", ">", "action", ")", "throws", "Exception", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", ...
Perform the given action with a guarantee that the locks of the task are not revoked in the middle of action. This method first checks that all locks for the given task and intervals are valid and perform the right action. The given action should be finished as soon as possible because all other methods in this class...
[ "Perform", "the", "given", "action", "with", "a", "guarantee", "that", "the", "locks", "of", "the", "task", "are", "not", "revoked", "in", "the", "middle", "of", "action", ".", "This", "method", "first", "checks", "that", "all", "locks", "for", "the", "g...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L622-L632
127,729
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.findLocksForTask
public List<TaskLock> findLocksForTask(final Task task) { giant.lock(); try { return Lists.transform( findLockPossesForTask(task), new Function<TaskLockPosse, TaskLock>() { @Override public TaskLock apply(TaskLockPosse taskLockPosse) { ...
java
public List<TaskLock> findLocksForTask(final Task task) { giant.lock(); try { return Lists.transform( findLockPossesForTask(task), new Function<TaskLockPosse, TaskLock>() { @Override public TaskLock apply(TaskLockPosse taskLockPosse) { ...
[ "public", "List", "<", "TaskLock", ">", "findLocksForTask", "(", "final", "Task", "task", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "return", "Lists", ".", "transform", "(", "findLockPossesForTask", "(", "task", ")", ",", "new", "Functio...
Return the currently-active locks for some task. @param task task for which to locate locks @return currently-active locks for the given task
[ "Return", "the", "currently", "-", "active", "locks", "for", "some", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L717-L736
127,730
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.unlock
public void unlock(final Task task, final Interval interval) { giant.lock(); try { final String dataSource = task.getDataSource(); final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(task.getDataSource()); if (dsRunning == null || dsRunning.isEmpt...
java
public void unlock(final Task task, final Interval interval) { giant.lock(); try { final String dataSource = task.getDataSource(); final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(task.getDataSource()); if (dsRunning == null || dsRunning.isEmpt...
[ "public", "void", "unlock", "(", "final", "Task", "task", ",", "final", "Interval", "interval", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "final", "String", "dataSource", "=", "task", ".", "getDataSource", "(", ")", ";", "final", "Navi...
Release lock held for a task on a particular interval. Does nothing if the task does not currently hold the mentioned lock. @param task task to unlock @param interval interval to unlock
[ "Release", "lock", "held", "for", "a", "task", "on", "a", "particular", "interval", ".", "Does", "nothing", "if", "the", "task", "does", "not", "currently", "hold", "the", "mentioned", "lock", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L745-L823
127,731
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.remove
public void remove(final Task task) { giant.lock(); try { try { log.info("Removing task[%s] from activeTasks", task.getId()); for (final TaskLockPosse taskLockPosse : findLockPossesForTask(task)) { unlock(task, taskLockPosse.getTaskLock().getInterval()); } } ...
java
public void remove(final Task task) { giant.lock(); try { try { log.info("Removing task[%s] from activeTasks", task.getId()); for (final TaskLockPosse taskLockPosse : findLockPossesForTask(task)) { unlock(task, taskLockPosse.getTaskLock().getInterval()); } } ...
[ "public", "void", "remove", "(", "final", "Task", "task", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "try", "{", "log", ".", "info", "(", "\"Removing task[%s] from activeTasks\"", ",", "task", ".", "getId", "(", ")", ")", ";", "for", ...
Release all locks for a task and remove task from set of active tasks. Does nothing if the task is not currently locked or not an active task. @param task task to unlock
[ "Release", "all", "locks", "for", "a", "task", "and", "remove", "task", "from", "set", "of", "active", "tasks", ".", "Does", "nothing", "if", "the", "task", "is", "not", "currently", "locked", "or", "not", "an", "active", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L842-L859
127,732
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.findLockPossesForTask
private List<TaskLockPosse> findLockPossesForTask(final Task task) { giant.lock(); try { // Scan through all locks for this datasource final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(task.getDataSource()); if (dsRunning == null) { retur...
java
private List<TaskLockPosse> findLockPossesForTask(final Task task) { giant.lock(); try { // Scan through all locks for this datasource final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(task.getDataSource()); if (dsRunning == null) { retur...
[ "private", "List", "<", "TaskLockPosse", ">", "findLockPossesForTask", "(", "final", "Task", "task", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "// Scan through all locks for this datasource", "final", "NavigableMap", "<", "DateTime", ",", "SortedM...
Return the currently-active lock posses for some task. @param task task for which to locate locks
[ "Return", "the", "currently", "-", "active", "lock", "posses", "for", "some", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L866-L886
127,733
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.findLockPossesOverlapsInterval
private List<TaskLockPosse> findLockPossesOverlapsInterval(final String dataSource, final Interval interval) { giant.lock(); try { final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(dataSource); if (dsRunning == null) { // No locks at all ...
java
private List<TaskLockPosse> findLockPossesOverlapsInterval(final String dataSource, final Interval interval) { giant.lock(); try { final NavigableMap<DateTime, SortedMap<Interval, List<TaskLockPosse>>> dsRunning = running.get(dataSource); if (dsRunning == null) { // No locks at all ...
[ "private", "List", "<", "TaskLockPosse", ">", "findLockPossesOverlapsInterval", "(", "final", "String", "dataSource", ",", "final", "Interval", "interval", ")", "{", "giant", ".", "lock", "(", ")", ";", "try", "{", "final", "NavigableMap", "<", "DateTime", ","...
Return all locks that overlap some search interval.
[ "Return", "all", "locks", "that", "overlap", "some", "search", "interval", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L906-L939
127,734
apache/incubator-druid
extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesUtils.java
CloudFilesUtils.retryCloudFilesOperation
public static <T> T retryCloudFilesOperation(Task<T> f, final int maxTries) throws Exception { return RetryUtils.retry(f, CLOUDFILESRETRY, maxTries); }
java
public static <T> T retryCloudFilesOperation(Task<T> f, final int maxTries) throws Exception { return RetryUtils.retry(f, CLOUDFILESRETRY, maxTries); }
[ "public", "static", "<", "T", ">", "T", "retryCloudFilesOperation", "(", "Task", "<", "T", ">", "f", ",", "final", "int", "maxTries", ")", "throws", "Exception", "{", "return", "RetryUtils", ".", "retry", "(", "f", ",", "CLOUDFILESRETRY", ",", "maxTries", ...
Retries CloudFiles operations that fail due to io-related exceptions.
[ "Retries", "CloudFiles", "operations", "that", "fail", "due", "to", "io", "-", "related", "exceptions", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesUtils.java#L52-L55
127,735
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/filter/NotDimFilter.java
NotDimFilter.getDimensionRangeSet
@Override public RangeSet<String> getDimensionRangeSet(String dimension) { if (field instanceof AndDimFilter) { List<DimFilter> fields = ((AndDimFilter) field).getFields(); return new OrDimFilter(Lists.transform(fields, NotDimFilter::new)).getDimensionRangeSet(dimension); } if (field instanc...
java
@Override public RangeSet<String> getDimensionRangeSet(String dimension) { if (field instanceof AndDimFilter) { List<DimFilter> fields = ((AndDimFilter) field).getFields(); return new OrDimFilter(Lists.transform(fields, NotDimFilter::new)).getDimensionRangeSet(dimension); } if (field instanc...
[ "@", "Override", "public", "RangeSet", "<", "String", ">", "getDimensionRangeSet", "(", "String", "dimension", ")", "{", "if", "(", "field", "instanceof", "AndDimFilter", ")", "{", "List", "<", "DimFilter", ">", "fields", "=", "(", "(", "AndDimFilter", ")", ...
There are some special cases involving null that require special casing for And and Or instead of simply taking the complement Example 1 : "NOT ( [0,INF) OR null)" The inside of NOT would evaluate to null, and the complement would also be null. However, by breaking the NOT, this statement is "NOT([0,INF)) AND NOT(null...
[ "There", "are", "some", "special", "cases", "involving", "null", "that", "require", "special", "casing", "for", "And", "and", "Or", "instead", "of", "simply", "taking", "the", "complement" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/filter/NotDimFilter.java#L86-L102
127,736
apache/incubator-druid
server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java
DruidLeaderClient.go
public FullResponseHolder go( Request request, HttpResponseHandler<FullResponseHolder, FullResponseHolder> responseHandler ) throws IOException, InterruptedException { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); for (int counter = 0; counter < MAX_RETRIES; cou...
java
public FullResponseHolder go( Request request, HttpResponseHandler<FullResponseHolder, FullResponseHolder> responseHandler ) throws IOException, InterruptedException { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); for (int counter = 0; counter < MAX_RETRIES; cou...
[ "public", "FullResponseHolder", "go", "(", "Request", "request", ",", "HttpResponseHandler", "<", "FullResponseHolder", ",", "FullResponseHolder", ">", "responseHandler", ")", "throws", "IOException", ",", "InterruptedException", "{", "Preconditions", ".", "checkState", ...
Executes a Request object aimed at the leader. Throws IOException if the leader cannot be located.
[ "Executes", "a", "Request", "object", "aimed", "at", "the", "leader", ".", "Throws", "IOException", "if", "the", "leader", "cannot", "be", "located", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java#L162-L253
127,737
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouper.java
SpillingGrouper.mergeAndGetDictionary
public List<String> mergeAndGetDictionary() { final Set<String> mergedDictionary = new HashSet<>(); mergedDictionary.addAll(keySerde.getDictionary()); for (File dictFile : dictionaryFiles) { try ( final MappingIterator<String> dictIterator = spillMapper.readValues( spillMapp...
java
public List<String> mergeAndGetDictionary() { final Set<String> mergedDictionary = new HashSet<>(); mergedDictionary.addAll(keySerde.getDictionary()); for (File dictFile : dictionaryFiles) { try ( final MappingIterator<String> dictIterator = spillMapper.readValues( spillMapp...
[ "public", "List", "<", "String", ">", "mergeAndGetDictionary", "(", ")", "{", "final", "Set", "<", "String", ">", "mergedDictionary", "=", "new", "HashSet", "<>", "(", ")", ";", "mergedDictionary", ".", "addAll", "(", "keySerde", ".", "getDictionary", "(", ...
Returns a dictionary of string keys added to this grouper. Note that the dictionary of keySerde is spilled on local storage whenever the inner grouper is spilled. If there are spilled dictionaries, this method loads them from disk and returns a merged dictionary. @return a dictionary which is a list of unique string...
[ "Returns", "a", "dictionary", "of", "string", "keys", "added", "to", "this", "grouper", ".", "Note", "that", "the", "dictionary", "of", "keySerde", "is", "spilled", "on", "local", "storage", "whenever", "the", "inner", "grouper", "is", "spilled", ".", "If", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouper.java#L208-L230
127,738
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java
Bounds.not
public static BoundDimFilter not(final BoundDimFilter bound) { if (bound.getUpper() != null && bound.getLower() != null) { return null; } else if (bound.getUpper() != null) { return new BoundDimFilter( bound.getDimension(), bound.getUpper(), null, !bound.isU...
java
public static BoundDimFilter not(final BoundDimFilter bound) { if (bound.getUpper() != null && bound.getLower() != null) { return null; } else if (bound.getUpper() != null) { return new BoundDimFilter( bound.getDimension(), bound.getUpper(), null, !bound.isU...
[ "public", "static", "BoundDimFilter", "not", "(", "final", "BoundDimFilter", "bound", ")", "{", "if", "(", "bound", ".", "getUpper", "(", ")", "!=", "null", "&&", "bound", ".", "getLower", "(", ")", "!=", "null", ")", "{", "return", "null", ";", "}", ...
Negates single-ended Bound filters. @param bound filter @return negated filter, or null if this bound is double-ended.
[ "Negates", "single", "-", "ended", "Bound", "filters", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java#L43-L71
127,739
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java
BaseAppenderatorDriver.getSegment
private SegmentIdWithShardSpec getSegment( final InputRow row, final String sequenceName, final boolean skipSegmentLineageCheck ) throws IOException { synchronized (segments) { final DateTime timestamp = row.getTimestamp(); final SegmentIdWithShardSpec existing = getAppendableSegme...
java
private SegmentIdWithShardSpec getSegment( final InputRow row, final String sequenceName, final boolean skipSegmentLineageCheck ) throws IOException { synchronized (segments) { final DateTime timestamp = row.getTimestamp(); final SegmentIdWithShardSpec existing = getAppendableSegme...
[ "private", "SegmentIdWithShardSpec", "getSegment", "(", "final", "InputRow", "row", ",", "final", "String", "sequenceName", ",", "final", "boolean", "skipSegmentLineageCheck", ")", "throws", "IOException", "{", "synchronized", "(", "segments", ")", "{", "final", "Da...
Return a segment usable for "timestamp". May return null if no segment can be allocated. @param row input row @param sequenceName sequenceName for potential segment allocation @param skipSegmentLineageCheck if false, perform lineage validation using previousSegmentId for this sequence. S...
[ "Return", "a", "segment", "usable", "for", "timestamp", ".", "May", "return", "null", "if", "no", "segment", "can", "be", "allocated", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java#L319-L364
127,740
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java
BaseAppenderatorDriver.pushInBackground
ListenableFuture<SegmentsAndMetadata> pushInBackground( @Nullable final WrappedCommitter wrappedCommitter, final Collection<SegmentIdWithShardSpec> segmentIdentifiers, final boolean useUniquePath ) { log.info("Pushing segments in background: [%s]", Joiner.on(", ").join(segmentIdentifiers)); ...
java
ListenableFuture<SegmentsAndMetadata> pushInBackground( @Nullable final WrappedCommitter wrappedCommitter, final Collection<SegmentIdWithShardSpec> segmentIdentifiers, final boolean useUniquePath ) { log.info("Pushing segments in background: [%s]", Joiner.on(", ").join(segmentIdentifiers)); ...
[ "ListenableFuture", "<", "SegmentsAndMetadata", ">", "pushInBackground", "(", "@", "Nullable", "final", "WrappedCommitter", "wrappedCommitter", ",", "final", "Collection", "<", "SegmentIdWithShardSpec", ">", "segmentIdentifiers", ",", "final", "boolean", "useUniquePath", ...
Push the given segments in background. @param wrappedCommitter should not be null if you want to persist intermediate states @param segmentIdentifiers identifiers of the segments to be pushed @param useUniquePath true if the segment should be written to a path with a unique identifier @return a future for push...
[ "Push", "the", "given", "segments", "in", "background", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java#L464-L498
127,741
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/emitter/core/Batch.java
Batch.tryReserveEventSizeAndLock
private int tryReserveEventSizeAndLock(long state, int size) { Preconditions.checkArgument(size > 0); int bufferWatermark = bufferWatermark(state); while (true) { if (compareAndSetState(state, state + size + PARTY)) { return bufferWatermark; } state = getState(); if (isSeal...
java
private int tryReserveEventSizeAndLock(long state, int size) { Preconditions.checkArgument(size > 0); int bufferWatermark = bufferWatermark(state); while (true) { if (compareAndSetState(state, state + size + PARTY)) { return bufferWatermark; } state = getState(); if (isSeal...
[ "private", "int", "tryReserveEventSizeAndLock", "(", "long", "state", ",", "int", "size", ")", "{", "Preconditions", ".", "checkArgument", "(", "size", ">", "0", ")", ";", "int", "bufferWatermark", "=", "bufferWatermark", "(", "state", ")", ";", "while", "("...
Returns the buffer offset at which the caller has reserved the ability to write `size` bytes exclusively, or negative number, if the reservation attempt failed.
[ "Returns", "the", "buffer", "offset", "at", "which", "the", "caller", "has", "reserved", "the", "ability", "to", "write", "size", "bytes", "exclusively", "or", "negative", "number", "if", "the", "reservation", "attempt", "failed", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/emitter/core/Batch.java#L198-L217
127,742
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.serialize
public static void serialize(OutputStream out, BloomKFilter bloomFilter) throws IOException { /** * Serialized BloomKFilter format: * 1 byte for the number of hash functions. * 1 big endian int(That is how OutputStream works) for the number of longs in the bitset * big endina longs in the Bloo...
java
public static void serialize(OutputStream out, BloomKFilter bloomFilter) throws IOException { /** * Serialized BloomKFilter format: * 1 byte for the number of hash functions. * 1 big endian int(That is how OutputStream works) for the number of longs in the bitset * big endina longs in the Bloo...
[ "public", "static", "void", "serialize", "(", "OutputStream", "out", ",", "BloomKFilter", "bloomFilter", ")", "throws", "IOException", "{", "/**\n * Serialized BloomKFilter format:\n * 1 byte for the number of hash functions.\n * 1 big endian int(That is how OutputStream work...
Serialize a bloom filter @param out output stream to write to @param bloomFilter BloomKFilter that needs to be seralized
[ "Serialize", "a", "bloom", "filter" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L135-L149
127,743
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.serialize
public static void serialize(ByteBuffer out, int position, BloomKFilter bloomFilter) { /** * Serialized BloomKFilter format: * 1 byte for the number of hash functions. * 1 big endian int(to match OutputStream) for the number of longs in the bitset * big endian longs in the BloomKFilter bitset ...
java
public static void serialize(ByteBuffer out, int position, BloomKFilter bloomFilter) { /** * Serialized BloomKFilter format: * 1 byte for the number of hash functions. * 1 big endian int(to match OutputStream) for the number of longs in the bitset * big endian longs in the BloomKFilter bitset ...
[ "public", "static", "void", "serialize", "(", "ByteBuffer", "out", ",", "int", "position", ",", "BloomKFilter", "bloomFilter", ")", "{", "/**\n * Serialized BloomKFilter format:\n * 1 byte for the number of hash functions.\n * 1 big endian int(to match OutputStream) for the...
Serialize a bloom filter to a ByteBuffer. Does not mutate buffer position. @param out output buffer to write to @param position output buffer position @param bloomFilter BloomKFilter that needs to be seralized
[ "Serialize", "a", "bloom", "filter", "to", "a", "ByteBuffer", ".", "Does", "not", "mutate", "buffer", "position", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L235-L250
127,744
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.computeSizeBytes
public static int computeSizeBytes(long maxNumEntries) { // copied from constructor checkArgument(maxNumEntries > 0, "expectedEntries should be > 0"); long numBits = optimalNumOfBits(maxNumEntries, DEFAULT_FPP); int nLongs = (int) Math.ceil((double) numBits / (double) Long.SIZE); int padLongs = D...
java
public static int computeSizeBytes(long maxNumEntries) { // copied from constructor checkArgument(maxNumEntries > 0, "expectedEntries should be > 0"); long numBits = optimalNumOfBits(maxNumEntries, DEFAULT_FPP); int nLongs = (int) Math.ceil((double) numBits / (double) Long.SIZE); int padLongs = D...
[ "public", "static", "int", "computeSizeBytes", "(", "long", "maxNumEntries", ")", "{", "// copied from constructor", "checkArgument", "(", "maxNumEntries", ">", "0", ",", "\"expectedEntries should be > 0\"", ")", ";", "long", "numBits", "=", "optimalNumOfBits", "(", "...
Calculate size in bytes of a BloomKFilter for a given number of entries
[ "Calculate", "size", "in", "bytes", "of", "a", "BloomKFilter", "for", "a", "given", "number", "of", "entries" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L351-L360
127,745
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.merge
public void merge(BloomKFilter that) { if (this != that && this.m == that.m && this.k == that.k) { this.bitSet.putAll(that.bitSet); } else { throw new IllegalArgumentException("BloomKFilters are not compatible for merging." + " this - " + this + " that - " ...
java
public void merge(BloomKFilter that) { if (this != that && this.m == that.m && this.k == that.k) { this.bitSet.putAll(that.bitSet); } else { throw new IllegalArgumentException("BloomKFilters are not compatible for merging." + " this - " + this + " that - " ...
[ "public", "void", "merge", "(", "BloomKFilter", "that", ")", "{", "if", "(", "this", "!=", "that", "&&", "this", ".", "m", "==", "that", ".", "m", "&&", "this", ".", "k", "==", "that", ".", "k", ")", "{", "this", ".", "bitSet", ".", "putAll", "...
Merge the specified bloom filter with current bloom filter. @param that - bloom filter to merge
[ "Merge", "the", "specified", "bloom", "filter", "with", "current", "bloom", "filter", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L702-L710
127,746
apache/incubator-druid
server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClient.java
CoordinatorClient.isHandOffComplete
@Nullable public Boolean isHandOffComplete(String dataSource, SegmentDescriptor descriptor) { try { FullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest( HttpMethod.GET, StringUtils.format( "/druid/coordinator/v1/datasour...
java
@Nullable public Boolean isHandOffComplete(String dataSource, SegmentDescriptor descriptor) { try { FullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest( HttpMethod.GET, StringUtils.format( "/druid/coordinator/v1/datasour...
[ "@", "Nullable", "public", "Boolean", "isHandOffComplete", "(", "String", "dataSource", ",", "SegmentDescriptor", "descriptor", ")", "{", "try", "{", "FullResponseHolder", "response", "=", "druidLeaderClient", ".", "go", "(", "druidLeaderClient", ".", "makeRequest", ...
Checks the given segment is handed off or not. It can return null if the HTTP call returns 404 which can happen during rolling update.
[ "Checks", "the", "given", "segment", "is", "handed", "off", "or", "not", ".", "It", "can", "return", "null", "if", "the", "HTTP", "call", "returns", "404", "which", "can", "happen", "during", "rolling", "update", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClient.java#L59-L94
127,747
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java
DefaultLimitSpec.sortingOrderHasNonGroupingFields
public static boolean sortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions) { for (OrderByColumnSpec orderSpec : limitSpec.getColumns()) { int dimIndex = OrderByColumnSpec.getDimIndexForOrderBy(orderSpec, dimensions); if (dimIndex < 0) { return true; ...
java
public static boolean sortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions) { for (OrderByColumnSpec orderSpec : limitSpec.getColumns()) { int dimIndex = OrderByColumnSpec.getDimIndexForOrderBy(orderSpec, dimensions); if (dimIndex < 0) { return true; ...
[ "public", "static", "boolean", "sortingOrderHasNonGroupingFields", "(", "DefaultLimitSpec", "limitSpec", ",", "List", "<", "DimensionSpec", ">", "dimensions", ")", "{", "for", "(", "OrderByColumnSpec", "orderSpec", ":", "limitSpec", ".", "getColumns", "(", ")", ")",...
Check if a limitSpec has columns in the sorting order that are not part of the grouping fields represented by `dimensions`. @param limitSpec LimitSpec, assumed to be non-null @param dimensions Grouping fields for a groupBy query @return True if limitSpec has sorting columns not contained in dimensions
[ "Check", "if", "a", "limitSpec", "has", "columns", "in", "the", "sorting", "order", "that", "are", "not", "part", "of", "the", "grouping", "fields", "represented", "by", "dimensions", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java#L71-L80
127,748
apache/incubator-druid
core/src/main/java/org/apache/druid/guice/PolyBind.java
PolyBind.optionBinder
public static <T> MapBinder<String, T> optionBinder(Binder binder, Key<T> interfaceKey) { final TypeLiteral<T> interfaceType = interfaceKey.getTypeLiteral(); if (interfaceKey.getAnnotation() != null) { return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), interfaceType, interfaceKey.getA...
java
public static <T> MapBinder<String, T> optionBinder(Binder binder, Key<T> interfaceKey) { final TypeLiteral<T> interfaceType = interfaceKey.getTypeLiteral(); if (interfaceKey.getAnnotation() != null) { return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), interfaceType, interfaceKey.getA...
[ "public", "static", "<", "T", ">", "MapBinder", "<", "String", ",", "T", ">", "optionBinder", "(", "Binder", "binder", ",", "Key", "<", "T", ">", "interfaceKey", ")", "{", "final", "TypeLiteral", "<", "T", ">", "interfaceType", "=", "interfaceKey", ".", ...
Binds an option for a specific choice. The choice must already be registered on the injector for this to work. @param binder the binder for the injector that is being configured @param interfaceKey the interface that will have an option added to it. This must equal the Key provided to createChoice @param <T> interfa...
[ "Binds", "an", "option", "for", "a", "specific", "choice", ".", "The", "choice", "must", "already", "be", "registered", "on", "the", "injector", "for", "this", "to", "work", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/guice/PolyBind.java#L121-L133
127,749
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.offer
public void offer(float value) { // update min/max if (value < min) { min = value; } if (value > max) { max = value; } // initial value if (binCount == 0) { positions[0] = value; bins[0] = 1; count++; binCount++; return; } final int inde...
java
public void offer(float value) { // update min/max if (value < min) { min = value; } if (value > max) { max = value; } // initial value if (binCount == 0) { positions[0] = value; bins[0] = 1; count++; binCount++; return; } final int inde...
[ "public", "void", "offer", "(", "float", "value", ")", "{", "// update min/max", "if", "(", "value", "<", "min", ")", "{", "min", "=", "value", ";", "}", "if", "(", "value", ">", "max", ")", "{", "max", "=", "value", ";", "}", "// initial value", "...
Adds the given value to the histogram @param value the value to be added
[ "Adds", "the", "given", "value", "to", "the", "histogram" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L305-L380
127,750
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.shiftRight
protected void shiftRight(int start, int end) { float prevVal = positions[start]; long prevCnt = bins[start]; for (int i = start + 1; i <= end; ++i) { float tmpVal = positions[i]; long tmpCnt = bins[i]; positions[i] = prevVal; bins[i] = prevCnt; prevVal = tmpVal; pre...
java
protected void shiftRight(int start, int end) { float prevVal = positions[start]; long prevCnt = bins[start]; for (int i = start + 1; i <= end; ++i) { float tmpVal = positions[i]; long tmpCnt = bins[i]; positions[i] = prevVal; bins[i] = prevCnt; prevVal = tmpVal; pre...
[ "protected", "void", "shiftRight", "(", "int", "start", ",", "int", "end", ")", "{", "float", "prevVal", "=", "positions", "[", "start", "]", ";", "long", "prevCnt", "=", "bins", "[", "start", "]", ";", "for", "(", "int", "i", "=", "start", "+", "1...
Shifts the given range the histogram bins one slot to the right @param start index of the first bin to shift @param end index of the rightmost bin to shift into
[ "Shifts", "the", "given", "range", "the", "histogram", "bins", "one", "slot", "to", "the", "right" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L442-L457
127,751
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.shiftLeft
protected void shiftLeft(int start, int end) { for (int i = start; i < end; ++i) { positions[i] = positions[i + 1]; bins[i] = bins[i + 1]; } }
java
protected void shiftLeft(int start, int end) { for (int i = start; i < end; ++i) { positions[i] = positions[i + 1]; bins[i] = bins[i + 1]; } }
[ "protected", "void", "shiftLeft", "(", "int", "start", ",", "int", "end", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "end", ";", "++", "i", ")", "{", "positions", "[", "i", "]", "=", "positions", "[", "i", "+", "1", "]", "...
Shifts the given range of histogram bins one slot to the left @param start index of the leftmost empty bin to shift into @param end index of the last bin to shift left
[ "Shifts", "the", "given", "range", "of", "histogram", "bins", "one", "slot", "to", "the", "left" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L465-L471
127,752
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.copy
public ApproximateHistogram copy(ApproximateHistogram h) { if (h.size > this.size) { this.size = h.size; this.positions = new float[size]; this.bins = new long[size]; } System.arraycopy(h.positions, 0, this.positions, 0, h.binCount); System.arraycopy(h.bins, 0, this.bins, 0, h.binCo...
java
public ApproximateHistogram copy(ApproximateHistogram h) { if (h.size > this.size) { this.size = h.size; this.positions = new float[size]; this.bins = new long[size]; } System.arraycopy(h.positions, 0, this.positions, 0, h.binCount); System.arraycopy(h.bins, 0, this.bins, 0, h.binCo...
[ "public", "ApproximateHistogram", "copy", "(", "ApproximateHistogram", "h", ")", "{", "if", "(", "h", ".", "size", ">", "this", ".", "size", ")", "{", "this", ".", "size", "=", "h", ".", "size", ";", "this", ".", "positions", "=", "new", "float", "["...
Copies histogram h into the current histogram. @param h ApproximateHistogram to copy @return this histogram
[ "Copies", "histogram", "h", "into", "the", "current", "histogram", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L515-L530
127,753
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.foldMin
protected ApproximateHistogram foldMin( ApproximateHistogram h, float[] mergedPositions, long[] mergedBins, float[] deltas ) { // find common min / max float mergedMin = this.min < h.min ? this.min : h.min; float mergedMax = this.max > h.max ? this.max : h.max; long mergedCou...
java
protected ApproximateHistogram foldMin( ApproximateHistogram h, float[] mergedPositions, long[] mergedBins, float[] deltas ) { // find common min / max float mergedMin = this.min < h.min ? this.min : h.min; float mergedMax = this.max > h.max ? this.max : h.max; long mergedCou...
[ "protected", "ApproximateHistogram", "foldMin", "(", "ApproximateHistogram", "h", ",", "float", "[", "]", "mergedPositions", ",", "long", "[", "]", "mergedBins", ",", "float", "[", "]", "deltas", ")", "{", "// find common min / max", "float", "mergedMin", "=", "...
approximate histogram solution using min heap to store location of min deltas
[ "approximate", "histogram", "solution", "using", "min", "heap", "to", "store", "location", "of", "min", "deltas" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L533-L613
127,754
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.mergeBins
private static void mergeBins( int mergedBinCount, float[] mergedPositions, long[] mergedBins, float[] deltas, int numMerge, int[] next, int[] prev ) { // repeatedly search for two closest bins, merge them and update the corresponding deltas // maintain index to th...
java
private static void mergeBins( int mergedBinCount, float[] mergedPositions, long[] mergedBins, float[] deltas, int numMerge, int[] next, int[] prev ) { // repeatedly search for two closest bins, merge them and update the corresponding deltas // maintain index to th...
[ "private", "static", "void", "mergeBins", "(", "int", "mergedBinCount", ",", "float", "[", "]", "mergedPositions", ",", "long", "[", "]", "mergedBins", ",", "float", "[", "]", "deltas", ",", "int", "numMerge", ",", "int", "[", "]", "next", ",", "int", ...
mergeBins performs the given number of bin merge operations on the given histogram It repeatedly merges the two closest bins until it has performed the requested number of merge operations. Merges are done in-place and unused bins have unknown state next / prev maintains a doubly-linked list of valid bin indices into...
[ "mergeBins", "performs", "the", "given", "number", "of", "bin", "merge", "operations", "on", "the", "given", "histogram" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L879-L978
127,755
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.heapify
private static void heapify(int[] heap, int[] reverseIndex, int count, float[] values) { int start = (count - 2) / 2; while (start >= 0) { siftDown(heap, reverseIndex, start, count - 1, values); start--; } }
java
private static void heapify(int[] heap, int[] reverseIndex, int count, float[] values) { int start = (count - 2) / 2; while (start >= 0) { siftDown(heap, reverseIndex, start, count - 1, values); start--; } }
[ "private", "static", "void", "heapify", "(", "int", "[", "]", "heap", ",", "int", "[", "]", "reverseIndex", ",", "int", "count", ",", "float", "[", "]", "values", ")", "{", "int", "start", "=", "(", "count", "-", "2", ")", "/", "2", ";", "while",...
Builds a min-heap and a reverseIndex into the heap from the given array of values @param heap min-heap stored as indices into the array of values @param reverseIndex reverse index from the array of values into the heap @param count current size of the heap @param values values to be stored in the ...
[ "Builds", "a", "min", "-", "heap", "and", "a", "reverseIndex", "into", "the", "heap", "from", "the", "given", "array", "of", "values" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L988-L995
127,756
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.siftDown
private static void siftDown(int[] heap, int[] reverseIndex, int start, int end, float[] values) { int root = start; while (root * 2 + 1 <= end) { int child = root * 2 + 1; int swap = root; if (values[heap[swap]] > values[heap[child]]) { swap = child; } if (child + 1 <= e...
java
private static void siftDown(int[] heap, int[] reverseIndex, int start, int end, float[] values) { int root = start; while (root * 2 + 1 <= end) { int child = root * 2 + 1; int swap = root; if (values[heap[swap]] > values[heap[child]]) { swap = child; } if (child + 1 <= e...
[ "private", "static", "void", "siftDown", "(", "int", "[", "]", "heap", ",", "int", "[", "]", "reverseIndex", ",", "int", "start", ",", "int", "end", ",", "float", "[", "]", "values", ")", "{", "int", "root", "=", "start", ";", "while", "(", "root",...
Rebalances the min-heap by pushing values from the top down and simultaneously updating the reverse index @param heap min-heap stored as indices into the array of values @param reverseIndex reverse index from the array of values into the heap @param start index to start re-balancing from @param end ...
[ "Rebalances", "the", "min", "-", "heap", "by", "pushing", "values", "from", "the", "top", "down", "and", "simultaneously", "updating", "the", "reverse", "index" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1006-L1033
127,757
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.heapDelete
private static int heapDelete(int[] heap, int[] reverseIndex, int count, int heapIndex, float[] values) { int end = count - 1; reverseIndex[heap[heapIndex]] = -1; heap[heapIndex] = heap[end]; reverseIndex[heap[heapIndex]] = heapIndex; end--; siftDown(heap, reverseIndex, heapIndex, end, valu...
java
private static int heapDelete(int[] heap, int[] reverseIndex, int count, int heapIndex, float[] values) { int end = count - 1; reverseIndex[heap[heapIndex]] = -1; heap[heapIndex] = heap[end]; reverseIndex[heap[heapIndex]] = heapIndex; end--; siftDown(heap, reverseIndex, heapIndex, end, valu...
[ "private", "static", "int", "heapDelete", "(", "int", "[", "]", "heap", ",", "int", "[", "]", "reverseIndex", ",", "int", "count", ",", "int", "heapIndex", ",", "float", "[", "]", "values", ")", "{", "int", "end", "=", "count", "-", "1", ";", "reve...
Deletes an item from the min-heap and updates the reverse index @param heap min-heap stored as indices into the array of values @param reverseIndex reverse index from the array of values into the heap @param count current size of the heap @param heapIndex index of the item to be deleted @param values...
[ "Deletes", "an", "item", "from", "the", "min", "-", "heap", "and", "updates", "the", "reverse", "index" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1044-L1056
127,758
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.combineBins
private static int combineBins( int leftBinCount, float[] leftPositions, long[] leftBins, int rightBinCount, float[] rightPositions, long[] rightBins, float[] mergedPositions, long[] mergedBins, float[] deltas ) { int i = 0; int j = 0; int k = 0; ...
java
private static int combineBins( int leftBinCount, float[] leftPositions, long[] leftBins, int rightBinCount, float[] rightPositions, long[] rightBins, float[] mergedPositions, long[] mergedBins, float[] deltas ) { int i = 0; int j = 0; int k = 0; ...
[ "private", "static", "int", "combineBins", "(", "int", "leftBinCount", ",", "float", "[", "]", "leftPositions", ",", "long", "[", "]", "leftBins", ",", "int", "rightBinCount", ",", "float", "[", "]", "rightPositions", ",", "long", "[", "]", "rightBins", ",...
Combines two sets of histogram bins using merge-sort and computes the delta between consecutive bin positions. Duplicate bins are merged together. @param leftBinCount @param leftPositions @param leftBins @param rightBinCount @param rightPositions @param rightBins @param mergedPositions array to store the combined bin ...
[ "Combines", "two", "sets", "of", "histogram", "bins", "using", "merge", "-", "sort", "and", "computes", "the", "delta", "between", "consecutive", "bin", "positions", ".", "Duplicate", "bins", "are", "merged", "together", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1074-L1111
127,759
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toBytes
@JsonValue public byte[] toBytes() { ByteBuffer buf = ByteBuffer.allocate(getMinStorageSize()); toBytes(buf); return buf.array(); }
java
@JsonValue public byte[] toBytes() { ByteBuffer buf = ByteBuffer.allocate(getMinStorageSize()); toBytes(buf); return buf.array(); }
[ "@", "JsonValue", "public", "byte", "[", "]", "toBytes", "(", ")", "{", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "allocate", "(", "getMinStorageSize", "(", ")", ")", ";", "toBytes", "(", "buf", ")", ";", "return", "buf", ".", "array", "(", ")", "...
Returns a byte-array representation of this ApproximateHistogram object @return byte array representation
[ "Returns", "a", "byte", "-", "array", "representation", "of", "this", "ApproximateHistogram", "object" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1118-L1124
127,760
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.canStoreCompact
public boolean canStoreCompact() { final long exactCount = getExactCount(); return (size <= Short.MAX_VALUE && exactCount <= Byte.MAX_VALUE && (count - exactCount) <= Byte.MAX_VALUE); }
java
public boolean canStoreCompact() { final long exactCount = getExactCount(); return (size <= Short.MAX_VALUE && exactCount <= Byte.MAX_VALUE && (count - exactCount) <= Byte.MAX_VALUE); }
[ "public", "boolean", "canStoreCompact", "(", ")", "{", "final", "long", "exactCount", "=", "getExactCount", "(", ")", ";", "return", "(", "size", "<=", "Short", ".", "MAX_VALUE", "&&", "exactCount", "<=", "Byte", ".", "MAX_VALUE", "&&", "(", "count", "-", ...
Checks whether this approximate histogram can be stored in a compact form @return true if yes, false otherwise
[ "Checks", "whether", "this", "approximate", "histogram", "can", "be", "stored", "in", "a", "compact", "form" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1180-L1184
127,761
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toBytes
public void toBytes(ByteBuffer buf) { if (canStoreCompact() && getCompactStorageSize() < getSparseStorageSize()) { // store compact toBytesCompact(buf); } else { // store sparse toBytesSparse(buf); } }
java
public void toBytes(ByteBuffer buf) { if (canStoreCompact() && getCompactStorageSize() < getSparseStorageSize()) { // store compact toBytesCompact(buf); } else { // store sparse toBytesSparse(buf); } }
[ "public", "void", "toBytes", "(", "ByteBuffer", "buf", ")", "{", "if", "(", "canStoreCompact", "(", ")", "&&", "getCompactStorageSize", "(", ")", "<", "getSparseStorageSize", "(", ")", ")", "{", "// store compact", "toBytesCompact", "(", "buf", ")", ";", "}"...
Writes the representation of this ApproximateHistogram object to the given byte-buffer @param buf ByteBuffer to write the ApproximateHistogram to
[ "Writes", "the", "representation", "of", "this", "ApproximateHistogram", "object", "to", "the", "given", "byte", "-", "buffer" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1191-L1200
127,762
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toBytesDense
public void toBytesDense(ByteBuffer buf) { buf.putInt(size); buf.putInt(binCount); buf.asFloatBuffer().put(positions); buf.position(buf.position() + Float.BYTES * positions.length); buf.asLongBuffer().put(bins); buf.position(buf.position() + Long.BYTES * bins.length); buf.putFloat(min); ...
java
public void toBytesDense(ByteBuffer buf) { buf.putInt(size); buf.putInt(binCount); buf.asFloatBuffer().put(positions); buf.position(buf.position() + Float.BYTES * positions.length); buf.asLongBuffer().put(bins); buf.position(buf.position() + Long.BYTES * bins.length); buf.putFloat(min); ...
[ "public", "void", "toBytesDense", "(", "ByteBuffer", "buf", ")", "{", "buf", ".", "putInt", "(", "size", ")", ";", "buf", ".", "putInt", "(", "binCount", ")", ";", "buf", ".", "asFloatBuffer", "(", ")", ".", "put", "(", "positions", ")", ";", "buf", ...
Writes the dense representation of this ApproximateHistogram object to the given byte-buffer Requires 16 + 12 * size bytes of storage @param buf ByteBuffer to write the ApproximateHistogram to
[ "Writes", "the", "dense", "representation", "of", "this", "ApproximateHistogram", "object", "to", "the", "given", "byte", "-", "buffer" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1209-L1221
127,763
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toBytesSparse
public void toBytesSparse(ByteBuffer buf) { buf.putInt(size); buf.putInt(-1 * binCount); // use negative binCount to indicate sparse storage for (int i = 0; i < binCount; ++i) { buf.putFloat(positions[i]); } for (int i = 0; i < binCount; ++i) { buf.putLong(bins[i]); } buf.putFl...
java
public void toBytesSparse(ByteBuffer buf) { buf.putInt(size); buf.putInt(-1 * binCount); // use negative binCount to indicate sparse storage for (int i = 0; i < binCount; ++i) { buf.putFloat(positions[i]); } for (int i = 0; i < binCount; ++i) { buf.putLong(bins[i]); } buf.putFl...
[ "public", "void", "toBytesSparse", "(", "ByteBuffer", "buf", ")", "{", "buf", ".", "putInt", "(", "size", ")", ";", "buf", ".", "putInt", "(", "-", "1", "*", "binCount", ")", ";", "// use negative binCount to indicate sparse storage", "for", "(", "int", "i",...
Writes the sparse representation of this ApproximateHistogram object to the given byte-buffer Requires 16 + 12 * binCount bytes of storage @param buf ByteBuffer to write the ApproximateHistogram to
[ "Writes", "the", "sparse", "representation", "of", "this", "ApproximateHistogram", "object", "to", "the", "given", "byte", "-", "buffer" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1230-L1242
127,764
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toBytesCompact
public void toBytesCompact(ByteBuffer buf) { Preconditions.checkState(canStoreCompact(), "Approximate histogram cannot be stored in compact form"); buf.putShort((short) (-1 * size)); // use negative size to indicate compact storage final long exactCount = getExactCount(); if (exactCount != count) { ...
java
public void toBytesCompact(ByteBuffer buf) { Preconditions.checkState(canStoreCompact(), "Approximate histogram cannot be stored in compact form"); buf.putShort((short) (-1 * size)); // use negative size to indicate compact storage final long exactCount = getExactCount(); if (exactCount != count) { ...
[ "public", "void", "toBytesCompact", "(", "ByteBuffer", "buf", ")", "{", "Preconditions", ".", "checkState", "(", "canStoreCompact", "(", ")", ",", "\"Approximate histogram cannot be stored in compact form\"", ")", ";", "buf", ".", "putShort", "(", "(", "short", ")",...
Returns a compact byte-buffer representation of this ApproximateHistogram object storing actual values as opposed to histogram bins Requires 3 + 4 * count bytes of storage with count &lt;= 127 @param buf ByteBuffer to write the ApproximateHistogram to
[ "Returns", "a", "compact", "byte", "-", "buffer", "representation", "of", "this", "ApproximateHistogram", "object", "storing", "actual", "values", "as", "opposed", "to", "histogram", "bins" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1252-L1288
127,765
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.fromBytes
public static ApproximateHistogram fromBytes(byte[] bytes) { ByteBuffer buf = ByteBuffer.wrap(bytes); return fromBytes(buf); }
java
public static ApproximateHistogram fromBytes(byte[] bytes) { ByteBuffer buf = ByteBuffer.wrap(bytes); return fromBytes(buf); }
[ "public", "static", "ApproximateHistogram", "fromBytes", "(", "byte", "[", "]", "bytes", ")", "{", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "wrap", "(", "bytes", ")", ";", "return", "fromBytes", "(", "buf", ")", ";", "}" ]
Constructs an Approximate Histogram object from the given byte-array representation @param bytes byte array to construct an ApproximateHistogram from @return ApproximateHistogram constructed from the given byte array
[ "Constructs", "an", "Approximate", "Histogram", "object", "from", "the", "given", "byte", "-", "array", "representation" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1297-L1301
127,766
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.fromBytesCompact
public static ApproximateHistogram fromBytesCompact(ByteBuffer buf) { short size = (short) (-1 * buf.getShort()); byte count = buf.get(); if (count >= 0) { // only exact bins ApproximateHistogram histogram = new ApproximateHistogram(size); for (int i = 0; i < count; ++i) { histo...
java
public static ApproximateHistogram fromBytesCompact(ByteBuffer buf) { short size = (short) (-1 * buf.getShort()); byte count = buf.get(); if (count >= 0) { // only exact bins ApproximateHistogram histogram = new ApproximateHistogram(size); for (int i = 0; i < count; ++i) { histo...
[ "public", "static", "ApproximateHistogram", "fromBytesCompact", "(", "ByteBuffer", "buf", ")", "{", "short", "size", "=", "(", "short", ")", "(", "-", "1", "*", "buf", ".", "getShort", "(", ")", ")", ";", "byte", "count", "=", "buf", ".", "get", "(", ...
Constructs an ApproximateHistogram object from the given compact byte-buffer representation @param buf ByteBuffer to construct an ApproximateHistogram from @return ApproximateHistogram constructed from the given ByteBuffer
[ "Constructs", "an", "ApproximateHistogram", "object", "from", "the", "given", "compact", "byte", "-", "buffer", "representation" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1364-L1431
127,767
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.fromBytes
public static ApproximateHistogram fromBytes(ByteBuffer buf) { // negative size indicates compact representation // this works regardless of whether we use int or short for the size since the leftmost bit is the sign bit if (buf.getShort(buf.position()) < 0) { return fromBytesCompact(buf); } els...
java
public static ApproximateHistogram fromBytes(ByteBuffer buf) { // negative size indicates compact representation // this works regardless of whether we use int or short for the size since the leftmost bit is the sign bit if (buf.getShort(buf.position()) < 0) { return fromBytesCompact(buf); } els...
[ "public", "static", "ApproximateHistogram", "fromBytes", "(", "ByteBuffer", "buf", ")", "{", "// negative size indicates compact representation", "// this works regardless of whether we use int or short for the size since the leftmost bit is the sign bit", "if", "(", "buf", ".", "getSh...
Constructs an ApproximateHistogram object from the given byte-buffer representation @param buf ByteBuffer to construct an ApproximateHistogram from @return ApproximateHistogram constructed from the given ByteBuffer
[ "Constructs", "an", "ApproximateHistogram", "object", "from", "the", "given", "byte", "-", "buffer", "representation" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1440-L1454
127,768
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.sum
public double sum(final float b) { if (b < min) { return 0; } if (b >= max) { return count; } int index = Arrays.binarySearch(positions, 0, binCount, b); boolean exactMatch = index >= 0; index = exactMatch ? index : -(index + 1); // we want positions[index] <= b < positio...
java
public double sum(final float b) { if (b < min) { return 0; } if (b >= max) { return count; } int index = Arrays.binarySearch(positions, 0, binCount, b); boolean exactMatch = index >= 0; index = exactMatch ? index : -(index + 1); // we want positions[index] <= b < positio...
[ "public", "double", "sum", "(", "final", "float", "b", ")", "{", "if", "(", "b", "<", "min", ")", "{", "return", "0", ";", "}", "if", "(", "b", ">=", "max", ")", "{", "return", "count", ";", "}", "int", "index", "=", "Arrays", ".", "binarySearc...
Returns the approximate number of items less than or equal to b in the histogram @param b the cutoff @return the approximate number of items less than or equal to b
[ "Returns", "the", "approximate", "number", "of", "items", "less", "than", "or", "equal", "to", "b", "in", "the", "histogram" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1463-L1517
127,769
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toHistogram
public Histogram toHistogram(final float[] breaks) { final double[] approximateBins = new double[breaks.length - 1]; double prev = sum(breaks[0]); for (int i = 1; i < breaks.length; ++i) { double s = sum(breaks[i]); approximateBins[i - 1] = (float) (s - prev); prev = s; } retur...
java
public Histogram toHistogram(final float[] breaks) { final double[] approximateBins = new double[breaks.length - 1]; double prev = sum(breaks[0]); for (int i = 1; i < breaks.length; ++i) { double s = sum(breaks[i]); approximateBins[i - 1] = (float) (s - prev); prev = s; } retur...
[ "public", "Histogram", "toHistogram", "(", "final", "float", "[", "]", "breaks", ")", "{", "final", "double", "[", "]", "approximateBins", "=", "new", "double", "[", "breaks", ".", "length", "-", "1", "]", ";", "double", "prev", "=", "sum", "(", "break...
Computes a visual representation of the approximate histogram with bins laid out according to the given breaks @param breaks breaks defining the histogram bins @return visual representation of the histogram
[ "Computes", "a", "visual", "representation", "of", "the", "approximate", "histogram", "with", "bins", "laid", "out", "according", "to", "the", "given", "breaks" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1610-L1622
127,770
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toHistogram
public Histogram toHistogram(int size) { Preconditions.checkArgument(size > 1, "histogram size must be greater than 1"); float[] breaks = new float[size + 1]; float delta = (max - min) / (size - 1); breaks[0] = min - delta; for (int i = 1; i < breaks.length - 1; ++i) { breaks[i] = breaks[i ...
java
public Histogram toHistogram(int size) { Preconditions.checkArgument(size > 1, "histogram size must be greater than 1"); float[] breaks = new float[size + 1]; float delta = (max - min) / (size - 1); breaks[0] = min - delta; for (int i = 1; i < breaks.length - 1; ++i) { breaks[i] = breaks[i ...
[ "public", "Histogram", "toHistogram", "(", "int", "size", ")", "{", "Preconditions", ".", "checkArgument", "(", "size", ">", "1", ",", "\"histogram size must be greater than 1\"", ")", ";", "float", "[", "]", "breaks", "=", "new", "float", "[", "size", "+", ...
Computes a visual representation of the approximate histogram with a given number of equal-sized bins @param size number of equal-sized bins to divide the histogram into @return visual representation of the histogram
[ "Computes", "a", "visual", "representation", "of", "the", "approximate", "histogram", "with", "a", "given", "number", "of", "equal", "-", "sized", "bins" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1631-L1643
127,771
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.toHistogram
public Histogram toHistogram(final float bucketSize, final float offset) { final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset; final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset; final float firstBreak = Ma...
java
public Histogram toHistogram(final float bucketSize, final float offset) { final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset; final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset; final float firstBreak = Ma...
[ "public", "Histogram", "toHistogram", "(", "final", "float", "bucketSize", ",", "final", "float", "offset", ")", "{", "final", "float", "minFloor", "=", "(", "float", ")", "Math", ".", "floor", "(", "(", "min", "(", ")", "-", "offset", ")", "/", "bucke...
Computes a visual representation given an initial breakpoint, offset, and a bucket size. @param bucketSize the size of each bucket @param offset the location of one breakpoint @return visual representation of the histogram
[ "Computes", "a", "visual", "representation", "given", "an", "initial", "breakpoint", "offset", "and", "a", "bucket", "size", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1653-L1698
127,772
apache/incubator-druid
indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java
HadoopDruidIndexerConfig.getBucket
public Optional<Bucket> getBucket(InputRow inputRow) { final Optional<Interval> timeBucket = schema.getDataSchema().getGranularitySpec().bucketInterval( DateTimes.utc(inputRow.getTimestampFromEpoch()) ); if (!timeBucket.isPresent()) { return Optional.absent(); } final DateTime bucket...
java
public Optional<Bucket> getBucket(InputRow inputRow) { final Optional<Interval> timeBucket = schema.getDataSchema().getGranularitySpec().bucketInterval( DateTimes.utc(inputRow.getTimestampFromEpoch()) ); if (!timeBucket.isPresent()) { return Optional.absent(); } final DateTime bucket...
[ "public", "Optional", "<", "Bucket", ">", "getBucket", "(", "InputRow", "inputRow", ")", "{", "final", "Optional", "<", "Interval", ">", "timeBucket", "=", "schema", ".", "getDataSchema", "(", ")", ".", "getGranularitySpec", "(", ")", ".", "bucketInterval", ...
Get the proper bucket for some input row. @param inputRow an InputRow @return the Bucket that this row belongs to
[ "Get", "the", "proper", "bucket", "for", "some", "input", "row", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java#L412-L436
127,773
apache/incubator-druid
indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java
HadoopDruidIndexerConfig.makeIntermediatePath
public Path makeIntermediatePath() { return new Path( StringUtils.format( "%s/%s/%s_%s", getWorkingPath(), schema.getDataSchema().getDataSource(), StringUtils.removeChar(schema.getTuningConfig().getVersion(), ':'), schema.getUniqueId() ) ...
java
public Path makeIntermediatePath() { return new Path( StringUtils.format( "%s/%s/%s_%s", getWorkingPath(), schema.getDataSchema().getDataSource(), StringUtils.removeChar(schema.getTuningConfig().getVersion(), ':'), schema.getUniqueId() ) ...
[ "public", "Path", "makeIntermediatePath", "(", ")", "{", "return", "new", "Path", "(", "StringUtils", ".", "format", "(", "\"%s/%s/%s_%s\"", ",", "getWorkingPath", "(", ")", ",", "schema", ".", "getDataSchema", "(", ")", ".", "getDataSource", "(", ")", ",", ...
Make the intermediate path for this job run. @return the intermediate path for this job run.
[ "Make", "the", "intermediate", "path", "for", "this", "job", "run", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java#L513-L524
127,774
apache/incubator-druid
extensions-core/lookups-cached-global/src/main/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactory.java
NamespaceLookupExtractorFactory.get
@Override public LookupExtractor get() { final Lock readLock = startStopSync.readLock(); try { readLock.lockInterruptibly(); } catch (InterruptedException e) { throw new RuntimeException(e); } try { if (entry == null) { throw new ISE("Factory [%s] not started", extr...
java
@Override public LookupExtractor get() { final Lock readLock = startStopSync.readLock(); try { readLock.lockInterruptibly(); } catch (InterruptedException e) { throw new RuntimeException(e); } try { if (entry == null) { throw new ISE("Factory [%s] not started", extr...
[ "@", "Override", "public", "LookupExtractor", "get", "(", ")", "{", "final", "Lock", "readLock", "=", "startStopSync", ".", "readLock", "(", ")", ";", "try", "{", "readLock", ".", "lockInterruptibly", "(", ")", ";", "}", "catch", "(", "InterruptedException",...
Grab the latest snapshot from the CacheScheduler's entry
[ "Grab", "the", "latest", "snapshot", "from", "the", "CacheScheduler", "s", "entry" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/lookups-cached-global/src/main/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactory.java#L191-L232
127,775
apache/incubator-druid
indexing-hadoop/src/main/java/org/apache/druid/indexer/path/StaticPathSpec.java
StaticPathSpec.addInputPath
private static void addInputPath(Job job, Iterable<String> pathStrings, Class<? extends InputFormat> inputFormatClass) { Configuration conf = job.getConfiguration(); StringBuilder inputFormats = new StringBuilder( StringUtils.nullToEmptyNonDruidDataString(conf.get(MultipleInputs.DIR_FORMATS)) ); ...
java
private static void addInputPath(Job job, Iterable<String> pathStrings, Class<? extends InputFormat> inputFormatClass) { Configuration conf = job.getConfiguration(); StringBuilder inputFormats = new StringBuilder( StringUtils.nullToEmptyNonDruidDataString(conf.get(MultipleInputs.DIR_FORMATS)) ); ...
[ "private", "static", "void", "addInputPath", "(", "Job", "job", ",", "Iterable", "<", "String", ">", "pathStrings", ",", "Class", "<", "?", "extends", "InputFormat", ">", "inputFormatClass", ")", "{", "Configuration", "conf", "=", "job", ".", "getConfiguration...
copied from MultipleInputs.addInputPath with slight modifications
[ "copied", "from", "MultipleInputs", ".", "addInputPath", "with", "slight", "modifications" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/StaticPathSpec.java#L126-L145
127,776
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/common/FileUtils.java
FileUtils.retryCopy
public static FileCopyResult retryCopy( final ByteSource byteSource, final File outFile, final Predicate<Throwable> shouldRetry, final int maxAttempts ) { try { StreamUtils.retryCopy( byteSource, Files.asByteSink(outFile), shouldRetry, maxAtt...
java
public static FileCopyResult retryCopy( final ByteSource byteSource, final File outFile, final Predicate<Throwable> shouldRetry, final int maxAttempts ) { try { StreamUtils.retryCopy( byteSource, Files.asByteSink(outFile), shouldRetry, maxAtt...
[ "public", "static", "FileCopyResult", "retryCopy", "(", "final", "ByteSource", "byteSource", ",", "final", "File", "outFile", ",", "final", "Predicate", "<", "Throwable", ">", "shouldRetry", ",", "final", "int", "maxAttempts", ")", "{", "try", "{", "StreamUtils"...
Copy input byte source to outFile. If outFile exists, it is attempted to be deleted. @param byteSource Supplier for an input stream that is to be copied. The resulting stream is closed each iteration @param outFile Where the file should be written to. @param shouldRetry Predicate indicating if an error is recover...
[ "Copy", "input", "byte", "source", "to", "outFile", ".", "If", "outFile", "exists", "it", "is", "attempted", "to", "be", "deleted", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/FileUtils.java#L70-L89
127,777
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.run
@Override public ListenableFuture<TaskStatus> run(final Task task) { final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask; if ((pendingTask = pendingTasks.get(task.getId())) != null) { log.info("Assigned a task[%s] that is already pending!", task.getId()); runPendingTasks(); ...
java
@Override public ListenableFuture<TaskStatus> run(final Task task) { final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask; if ((pendingTask = pendingTasks.get(task.getId())) != null) { log.info("Assigned a task[%s] that is already pending!", task.getId()); runPendingTasks(); ...
[ "@", "Override", "public", "ListenableFuture", "<", "TaskStatus", ">", "run", "(", "final", "Task", "task", ")", "{", "final", "RemoteTaskRunnerWorkItem", "completeTask", ",", "runningTask", ",", "pendingTask", ";", "if", "(", "(", "pendingTask", "=", "pendingTa...
A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task. @param task task to run
[ "A", "task", "will", "be", "run", "only", "if", "there", "is", "no", "current", "knowledge", "in", "the", "RemoteTaskRunner", "of", "the", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L512-L537
127,778
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.shutdown
@Override public void shutdown(final String taskId, String reason) { log.info("Shutdown [%s] because: [%s]", taskId, reason); if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) { log.info("This TaskRunner is stopped or not yet started. Ignoring shutdown command for task: %s", taskId); } else if...
java
@Override public void shutdown(final String taskId, String reason) { log.info("Shutdown [%s] because: [%s]", taskId, reason); if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) { log.info("This TaskRunner is stopped or not yet started. Ignoring shutdown command for task: %s", taskId); } else if...
[ "@", "Override", "public", "void", "shutdown", "(", "final", "String", "taskId", ",", "String", "reason", ")", "{", "log", ".", "info", "(", "\"Shutdown [%s] because: [%s]\"", ",", "taskId", ",", "reason", ")", ";", "if", "(", "!", "lifecycleLock", ".", "a...
Finds the worker running the task and forwards the shutdown signal to the worker. @param taskId - task id to shutdown
[ "Finds", "the", "worker", "running", "the", "task", "and", "forwards", "the", "shutdown", "signal", "to", "the", "worker", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L544-L590
127,779
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.runPendingTasks
private void runPendingTasks() { runPendingTasksExec.submit( new Callable<Void>() { @Override public Void call() { try { // make a copy of the pending tasks because tryAssignTask may delete tasks from pending and move them // in...
java
private void runPendingTasks() { runPendingTasksExec.submit( new Callable<Void>() { @Override public Void call() { try { // make a copy of the pending tasks because tryAssignTask may delete tasks from pending and move them // in...
[ "private", "void", "runPendingTasks", "(", ")", "{", "runPendingTasksExec", ".", "submit", "(", "new", "Callable", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", ")", "{", "try", "{", "// make a copy of the pending tasks becau...
This method uses a multi-threaded executor to extract all pending tasks and attempt to run them. Any tasks that are successfully assigned to a worker will be moved from pendingTasks to runningTasks. This method is thread-safe. This method should be run each time there is new worker capacity or if new tasks are assigned...
[ "This", "method", "uses", "a", "multi", "-", "threaded", "executor", "to", "extract", "all", "pending", "tasks", "and", "attempt", "to", "run", "them", ".", "Any", "tasks", "that", "are", "successfully", "assigned", "to", "a", "worker", "will", "be", "move...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L659-L708
127,780
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.cleanup
private void cleanup(final String taskId) { if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) { return; } final RemoteTaskRunnerWorkItem removed = completeTasks.remove(taskId); final Worker worker = removed.getWorker(); if (removed == null || worker == null) { log.makeAlert("WTF?! ...
java
private void cleanup(final String taskId) { if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) { return; } final RemoteTaskRunnerWorkItem removed = completeTasks.remove(taskId); final Worker worker = removed.getWorker(); if (removed == null || worker == null) { log.makeAlert("WTF?! ...
[ "private", "void", "cleanup", "(", "final", "String", "taskId", ")", "{", "if", "(", "!", "lifecycleLock", ".", "awaitStarted", "(", "1", ",", "TimeUnit", ".", "SECONDS", ")", ")", "{", "return", ";", "}", "final", "RemoteTaskRunnerWorkItem", "removed", "=...
Removes a task from the complete queue and clears out the ZK status path of the task. @param taskId - the task to cleanup
[ "Removes", "a", "task", "from", "the", "complete", "queue", "and", "clears", "out", "the", "ZK", "status", "path", "of", "the", "task", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L721-L746
127,781
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.tryAssignTask
private boolean tryAssignTask(final Task task, final RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId(...
java
private boolean tryAssignTask(final Task task, final RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId(...
[ "private", "boolean", "tryAssignTask", "(", "final", "Task", "task", ",", "final", "RemoteTaskRunnerWorkItem", "taskRunnerWorkItem", ")", "throws", "Exception", "{", "Preconditions", ".", "checkNotNull", "(", "task", ",", "\"task\"", ")", ";", "Preconditions", ".", ...
Ensures no workers are already running a task before assigning the task to a worker. It is possible that a worker is running a task that the RTR has no knowledge of. This occurs when the RTR needs to bootstrap after a restart. @param taskRunnerWorkItem - the task to assign @return true iff the task is now assigned
[ "Ensures", "no", "workers", "are", "already", "running", "a", "task", "before", "assigning", "the", "task", "to", "a", "worker", ".", "It", "is", "possible", "that", "a", "worker", "is", "running", "a", "task", "that", "the", "RTR", "has", "no", "knowled...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L757-L832
127,782
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.announceTask
private boolean announceTask( final Task task, final ZkWorker theZkWorker, final RemoteTaskRunnerWorkItem taskRunnerWorkItem ) throws Exception { Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId()), "task id != workItem id"); final String worker = theZkWorker.ge...
java
private boolean announceTask( final Task task, final ZkWorker theZkWorker, final RemoteTaskRunnerWorkItem taskRunnerWorkItem ) throws Exception { Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId()), "task id != workItem id"); final String worker = theZkWorker.ge...
[ "private", "boolean", "announceTask", "(", "final", "Task", "task", ",", "final", "ZkWorker", "theZkWorker", ",", "final", "RemoteTaskRunnerWorkItem", "taskRunnerWorkItem", ")", "throws", "Exception", "{", "Preconditions", ".", "checkArgument", "(", "task", ".", "ge...
Creates a ZK entry under a specific path associated with a worker. The worker is responsible for removing the task ZK entry and creating a task status ZK entry. @param theZkWorker The worker the task is assigned to @param taskRunnerWorkItem The task to be assigned @return boolean indicating whether the task wa...
[ "Creates", "a", "ZK", "entry", "under", "a", "specific", "path", "associated", "with", "a", "worker", ".", "The", "worker", "is", "responsible", "for", "removing", "the", "task", "ZK", "entry", "and", "creating", "a", "task", "status", "ZK", "entry", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L843-L901
127,783
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.updateWorker
private void updateWorker(final Worker worker) { final ZkWorker zkWorker = zkWorkers.get(worker.getHost()); if (zkWorker != null) { log.info("Worker[%s] updated its announcement from[%s] to[%s].", worker.getHost(), zkWorker.getWorker(), worker); zkWorker.setWorker(worker); } else { log.w...
java
private void updateWorker(final Worker worker) { final ZkWorker zkWorker = zkWorkers.get(worker.getHost()); if (zkWorker != null) { log.info("Worker[%s] updated its announcement from[%s] to[%s].", worker.getHost(), zkWorker.getWorker(), worker); zkWorker.setWorker(worker); } else { log.w...
[ "private", "void", "updateWorker", "(", "final", "Worker", "worker", ")", "{", "final", "ZkWorker", "zkWorker", "=", "zkWorkers", ".", "get", "(", "worker", ".", "getHost", "(", ")", ")", ";", "if", "(", "zkWorker", "!=", "null", ")", "{", "log", ".", ...
We allow workers to change their own capacities and versions. They cannot change their own hosts or ips without dropping themselves and re-announcing.
[ "We", "allow", "workers", "to", "change", "their", "own", "capacities", "and", "versions", ".", "They", "cannot", "change", "their", "own", "hosts", "or", "ips", "without", "dropping", "themselves", "and", "re", "-", "announcing", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L1060-L1072
127,784
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.removeWorker
private void removeWorker(final Worker worker) { log.info("Kaboom! Worker[%s] removed!", worker.getHost()); final ZkWorker zkWorker = zkWorkers.get(worker.getHost()); if (zkWorker != null) { try { scheduleTasksCleanupForWorker(worker.getHost(), getAssignedTasks(worker)); } catch...
java
private void removeWorker(final Worker worker) { log.info("Kaboom! Worker[%s] removed!", worker.getHost()); final ZkWorker zkWorker = zkWorkers.get(worker.getHost()); if (zkWorker != null) { try { scheduleTasksCleanupForWorker(worker.getHost(), getAssignedTasks(worker)); } catch...
[ "private", "void", "removeWorker", "(", "final", "Worker", "worker", ")", "{", "log", ".", "info", "(", "\"Kaboom! Worker[%s] removed!\"", ",", "worker", ".", "getHost", "(", ")", ")", ";", "final", "ZkWorker", "zkWorker", "=", "zkWorkers", ".", "get", "(", ...
When a ephemeral worker node disappears from ZK, incomplete running tasks will be retried by the logic in the status listener. We still have to make sure there are no tasks assigned to the worker but not yet running. @param worker - the removed worker
[ "When", "a", "ephemeral", "worker", "node", "disappears", "from", "ZK", "incomplete", "running", "tasks", "will", "be", "retried", "by", "the", "logic", "in", "the", "status", "listener", ".", "We", "still", "have", "to", "make", "sure", "there", "are", "n...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L1081-L1105
127,785
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
RemoteTaskRunner.scheduleTasksCleanupForWorker
private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { // This method is only called from the PathChildrenCache event handler, so this may look like a race, // but is actually not. cancelWorkerCleanup(worker); final ListenableScheduledFuture<?> cleanupTask =...
java
private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { // This method is only called from the PathChildrenCache event handler, so this may look like a race, // but is actually not. cancelWorkerCleanup(worker); final ListenableScheduledFuture<?> cleanupTask =...
[ "private", "void", "scheduleTasksCleanupForWorker", "(", "final", "String", "worker", ",", "final", "List", "<", "String", ">", "tasksToFail", ")", "{", "// This method is only called from the PathChildrenCache event handler, so this may look like a race,", "// but is actually not....
Schedule a task that will, at some point in the future, clean up znodes and issue failures for "tasksToFail" if they are being run by "worker".
[ "Schedule", "a", "task", "that", "will", "at", "some", "point", "in", "the", "future", "clean", "up", "znodes", "and", "issue", "failures", "for", "tasksToFail", "if", "they", "are", "being", "run", "by", "worker", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java#L1111-L1182
127,786
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/realtime/appenderator/AppenderatorImpl.java
AppenderatorImpl.persistHydrant
private int persistHydrant(FireHydrant indexToPersist, SegmentIdWithShardSpec identifier) { synchronized (indexToPersist) { if (indexToPersist.hasSwapped()) { log.info( "Segment[%s], Hydrant[%s] already swapped. Ignoring request to persist.", identifier, indexToPersist ...
java
private int persistHydrant(FireHydrant indexToPersist, SegmentIdWithShardSpec identifier) { synchronized (indexToPersist) { if (indexToPersist.hasSwapped()) { log.info( "Segment[%s], Hydrant[%s] already swapped. Ignoring request to persist.", identifier, indexToPersist ...
[ "private", "int", "persistHydrant", "(", "FireHydrant", "indexToPersist", ",", "SegmentIdWithShardSpec", "identifier", ")", "{", "synchronized", "(", "indexToPersist", ")", "{", "if", "(", "indexToPersist", ".", "hasSwapped", "(", ")", ")", "{", "log", ".", "inf...
Persists the given hydrant and returns the number of rows persisted. Must only be called in the single-threaded persistExecutor. @param indexToPersist hydrant to persist @param identifier the segment this hydrant is going to be part of @return the number of rows persisted
[ "Persists", "the", "given", "hydrant", "and", "returns", "the", "number", "of", "rows", "persisted", ".", "Must", "only", "be", "called", "in", "the", "single", "-", "threaded", "persistExecutor", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/AppenderatorImpl.java#L1245-L1286
127,787
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java
GroupByStrategyV2.getUniversalTimestamp
public static DateTime getUniversalTimestamp(final GroupByQuery query) { final Granularity gran = query.getGranularity(); final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, ""); if (!timestampStringFromContext.isEmpty()) { return DateTimes.utc(Long.parseLong(ti...
java
public static DateTime getUniversalTimestamp(final GroupByQuery query) { final Granularity gran = query.getGranularity(); final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, ""); if (!timestampStringFromContext.isEmpty()) { return DateTimes.utc(Long.parseLong(ti...
[ "public", "static", "DateTime", "getUniversalTimestamp", "(", "final", "GroupByQuery", "query", ")", "{", "final", "Granularity", "gran", "=", "query", ".", "getGranularity", "(", ")", ";", "final", "String", "timestampStringFromContext", "=", "query", ".", "getCo...
If "query" has a single universal timestamp, return it. Otherwise return null. This is useful for keeping timestamps in sync across partial queries that may have different intervals. @param query the query @return universal timestamp, or null
[ "If", "query", "has", "a", "single", "universal", "timestamp", "return", "it", ".", "Otherwise", "return", "null", ".", "This", "is", "useful", "for", "keeping", "timestamps", "in", "sync", "across", "partial", "queries", "that", "may", "have", "different", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java#L125-L138
127,788
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java
AggregatorUtil.pruneDependentPostAgg
public static List<PostAggregator> pruneDependentPostAgg(List<PostAggregator> postAggregatorList, String postAggName) { ArrayList<PostAggregator> rv = new ArrayList<>(); Set<String> deps = new HashSet<>(); deps.add(postAggName); // Iterate backwards to find the last calculated aggregate and add depend...
java
public static List<PostAggregator> pruneDependentPostAgg(List<PostAggregator> postAggregatorList, String postAggName) { ArrayList<PostAggregator> rv = new ArrayList<>(); Set<String> deps = new HashSet<>(); deps.add(postAggName); // Iterate backwards to find the last calculated aggregate and add depend...
[ "public", "static", "List", "<", "PostAggregator", ">", "pruneDependentPostAgg", "(", "List", "<", "PostAggregator", ">", "postAggregatorList", ",", "String", "postAggName", ")", "{", "ArrayList", "<", "PostAggregator", ">", "rv", "=", "new", "ArrayList", "<>", ...
returns the list of dependent postAggregators that should be calculated in order to calculate given postAgg @param postAggregatorList List of postAggregator, there is a restriction that the list should be in an order such that all the dependencies of any given aggregator should occur before that aggregator. See Aggreg...
[ "returns", "the", "list", "of", "dependent", "postAggregators", "that", "should", "be", "calculated", "in", "order", "to", "calculate", "given", "postAgg" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java#L134-L151
127,789
apache/incubator-druid
server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java
DruidNodeDiscoveryProvider.getForService
public DruidNodeDiscovery getForService(String serviceName) { return serviceDiscoveryMap.computeIfAbsent( serviceName, service -> { Set<NodeType> nodeTypesToWatch = DruidNodeDiscoveryProvider.SERVICE_TO_NODE_TYPES.get(service); if (nodeTypesToWatch == null) { throw...
java
public DruidNodeDiscovery getForService(String serviceName) { return serviceDiscoveryMap.computeIfAbsent( serviceName, service -> { Set<NodeType> nodeTypesToWatch = DruidNodeDiscoveryProvider.SERVICE_TO_NODE_TYPES.get(service); if (nodeTypesToWatch == null) { throw...
[ "public", "DruidNodeDiscovery", "getForService", "(", "String", "serviceName", ")", "{", "return", "serviceDiscoveryMap", ".", "computeIfAbsent", "(", "serviceName", ",", "service", "->", "{", "Set", "<", "NodeType", ">", "nodeTypesToWatch", "=", "DruidNodeDiscoveryPr...
Get DruidNodeDiscovery instance to discover nodes that announce given service in its metadata.
[ "Get", "DruidNodeDiscovery", "instance", "to", "discover", "nodes", "that", "announce", "given", "service", "in", "its", "metadata", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java#L59-L78
127,790
apache/incubator-druid
server/src/main/java/org/apache/druid/client/CachingClusteredClient.java
CachingClusteredClient.run
private <T> Sequence<T> run( final QueryPlus<T> queryPlus, final Map<String, Object> responseContext, final UnaryOperator<TimelineLookup<String, ServerSelector>> timelineConverter ) { return new SpecificQueryRunnable<>(queryPlus, responseContext).run(timelineConverter); }
java
private <T> Sequence<T> run( final QueryPlus<T> queryPlus, final Map<String, Object> responseContext, final UnaryOperator<TimelineLookup<String, ServerSelector>> timelineConverter ) { return new SpecificQueryRunnable<>(queryPlus, responseContext).run(timelineConverter); }
[ "private", "<", "T", ">", "Sequence", "<", "T", ">", "run", "(", "final", "QueryPlus", "<", "T", ">", "queryPlus", ",", "final", "Map", "<", "String", ",", "Object", ">", "responseContext", ",", "final", "UnaryOperator", "<", "TimelineLookup", "<", "Stri...
Run a query. The timelineConverter will be given the "master" timeline and can be used to return a different timeline, if desired. This is used by getQueryRunnerForSegments.
[ "Run", "a", "query", ".", "The", "timelineConverter", "will", "be", "given", "the", "master", "timeline", "and", "can", "be", "used", "to", "return", "a", "different", "timeline", "if", "desired", ".", "This", "is", "used", "by", "getQueryRunnerForSegments", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/CachingClusteredClient.java#L162-L169
127,791
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java
PooledTopNAlgorithm.aggregateDimValue
private static int aggregateDimValue( final int[] positions, final BufferAggregator[] theAggregators, final ByteBuffer resultsBuf, final int numBytesPerRecord, final int[] aggregatorOffsets, final int aggSize, final int aggExtra, final int dimIndex, int currentPosit...
java
private static int aggregateDimValue( final int[] positions, final BufferAggregator[] theAggregators, final ByteBuffer resultsBuf, final int numBytesPerRecord, final int[] aggregatorOffsets, final int aggSize, final int aggExtra, final int dimIndex, int currentPosit...
[ "private", "static", "int", "aggregateDimValue", "(", "final", "int", "[", "]", "positions", ",", "final", "BufferAggregator", "[", "]", "theAggregators", ",", "final", "ByteBuffer", "resultsBuf", ",", "final", "int", "numBytesPerRecord", ",", "final", "int", "[...
Returns a new currentPosition, incremented if a new position was initialized, otherwise the same position as passed in the last argument.
[ "Returns", "a", "new", "currentPosition", "incremented", "if", "a", "new", "position", "was", "initialized", "otherwise", "the", "same", "position", "as", "passed", "in", "the", "last", "argument", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java#L659-L717
127,792
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.toFilters
public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) .transform( new Function<DimFilter, Filter>() { @Override public Filter apply(D...
java
public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) .transform( new Function<DimFilter, Filter>() { @Override public Filter apply(D...
[ "public", "static", "List", "<", "Filter", ">", "toFilters", "(", "List", "<", "DimFilter", ">", "dimFilters", ")", "{", "return", "ImmutableList", ".", "copyOf", "(", "FunctionalIterable", ".", "create", "(", "dimFilters", ")", ".", "transform", "(", "new",...
Convert a list of DimFilters to a list of Filters. @param dimFilters list of DimFilters, should all be non-null @return list of Filters
[ "Convert", "a", "list", "of", "DimFilters", "to", "a", "list", "of", "Filters", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L79-L95
127,793
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.bitmapsFromIndexes
static Iterable<ImmutableBitmap> bitmapsFromIndexes(final IntIterable indexes, final BitmapIndex bitmapIndex) { // Do not use Iterables.transform() to avoid boxing/unboxing integers. return new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { ...
java
static Iterable<ImmutableBitmap> bitmapsFromIndexes(final IntIterable indexes, final BitmapIndex bitmapIndex) { // Do not use Iterables.transform() to avoid boxing/unboxing integers. return new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { ...
[ "static", "Iterable", "<", "ImmutableBitmap", ">", "bitmapsFromIndexes", "(", "final", "IntIterable", "indexes", ",", "final", "BitmapIndex", "bitmapIndex", ")", "{", "// Do not use Iterables.transform() to avoid boxing/unboxing integers.", "return", "new", "Iterable", "<", ...
Transform an iterable of indexes of bitmaps to an iterable of bitmaps @param indexes indexes of bitmaps @param bitmapIndex an object to retrieve bitmaps using indexes @return an iterable of bitmaps
[ "Transform", "an", "iterable", "of", "indexes", "of", "bitmaps", "to", "an", "iterable", "of", "bitmaps" ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L197-L229
127,794
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.matchPredicate
public static <T> T matchPredicate( final String dimension, final BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory, final Predicate<String> predicate ) { return bitmapResultFactory.unionDimensionValueBitmaps(matchPredicateNoUnion(dimension, selector, predicate)); ...
java
public static <T> T matchPredicate( final String dimension, final BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory, final Predicate<String> predicate ) { return bitmapResultFactory.unionDimensionValueBitmaps(matchPredicateNoUnion(dimension, selector, predicate)); ...
[ "public", "static", "<", "T", ">", "T", "matchPredicate", "(", "final", "String", "dimension", ",", "final", "BitmapIndexSelector", "selector", ",", "BitmapResultFactory", "<", "T", ">", "bitmapResultFactory", ",", "final", "Predicate", "<", "String", ">", "pred...
Return the union of bitmaps for all values matching a particular predicate. @param dimension dimension to look at @param selector bitmap selector @param bitmapResultFactory @param predicate predicate to use @return bitmap of matching rows @see #estimateSelectivity(String, BitmapIndexSelector, Predicate)
[ "Return", "the", "union", "of", "bitmaps", "for", "all", "values", "matching", "a", "particular", "predicate", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L242-L250
127,795
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.estimateSelectivity
public static double estimateSelectivity( final String dimension, final BitmapIndexSelector indexSelector, final Predicate<String> predicate ) { Preconditions.checkNotNull(dimension, "dimension"); Preconditions.checkNotNull(indexSelector, "selector"); Preconditions.checkNotNull(predica...
java
public static double estimateSelectivity( final String dimension, final BitmapIndexSelector indexSelector, final Predicate<String> predicate ) { Preconditions.checkNotNull(dimension, "dimension"); Preconditions.checkNotNull(indexSelector, "selector"); Preconditions.checkNotNull(predica...
[ "public", "static", "double", "estimateSelectivity", "(", "final", "String", "dimension", ",", "final", "BitmapIndexSelector", "indexSelector", ",", "final", "Predicate", "<", "String", ">", "predicate", ")", "{", "Preconditions", ".", "checkNotNull", "(", "dimensio...
Return an estimated selectivity for bitmaps of all values matching the given predicate. @param dimension dimension to look at @param indexSelector bitmap selector @param predicate predicate to use @return estimated selectivity @see #matchPredicate(String, BitmapIndexSelector, BitmapResultFactory, Predicate)
[ "Return", "an", "estimated", "selectivity", "for", "bitmaps", "of", "all", "values", "matching", "the", "given", "predicate", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L299-L328
127,796
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.estimateSelectivity
public static double estimateSelectivity( final BitmapIndex bitmapIndex, final IntList bitmaps, final long totalNumRows ) { long numMatchedRows = 0; for (int i = 0; i < bitmaps.size(); i++) { final ImmutableBitmap bitmap = bitmapIndex.getBitmap(bitmaps.getInt(i)); numMatchedRow...
java
public static double estimateSelectivity( final BitmapIndex bitmapIndex, final IntList bitmaps, final long totalNumRows ) { long numMatchedRows = 0; for (int i = 0; i < bitmaps.size(); i++) { final ImmutableBitmap bitmap = bitmapIndex.getBitmap(bitmaps.getInt(i)); numMatchedRow...
[ "public", "static", "double", "estimateSelectivity", "(", "final", "BitmapIndex", "bitmapIndex", ",", "final", "IntList", "bitmaps", ",", "final", "long", "totalNumRows", ")", "{", "long", "numMatchedRows", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";...
Return an estimated selectivity for bitmaps for the dimension values given by dimValueIndexes. @param bitmapIndex bitmap index @param bitmaps bitmaps to extract, by index @param totalNumRows number of rows in the column associated with this bitmap index @return estimated selectivity
[ "Return", "an", "estimated", "selectivity", "for", "bitmaps", "for", "the", "dimension", "values", "given", "by", "dimValueIndexes", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L339-L352
127,797
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
Filters.estimateSelectivity
public static double estimateSelectivity( final Iterator<ImmutableBitmap> bitmaps, final long totalNumRows ) { long numMatchedRows = 0; while (bitmaps.hasNext()) { final ImmutableBitmap bitmap = bitmaps.next(); numMatchedRows += bitmap.size(); } return Math.min(1., (double) ...
java
public static double estimateSelectivity( final Iterator<ImmutableBitmap> bitmaps, final long totalNumRows ) { long numMatchedRows = 0; while (bitmaps.hasNext()) { final ImmutableBitmap bitmap = bitmaps.next(); numMatchedRows += bitmap.size(); } return Math.min(1., (double) ...
[ "public", "static", "double", "estimateSelectivity", "(", "final", "Iterator", "<", "ImmutableBitmap", ">", "bitmaps", ",", "final", "long", "totalNumRows", ")", "{", "long", "numMatchedRows", "=", "0", ";", "while", "(", "bitmaps", ".", "hasNext", "(", ")", ...
Return an estimated selectivity for bitmaps given by an iterator. @param bitmaps iterator of bitmaps @param totalNumRows number of rows in the column associated with this bitmap index @return estimated selectivity
[ "Return", "an", "estimated", "selectivity", "for", "bitmaps", "given", "by", "an", "iterator", "." ]
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L362-L374
127,798
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/QueryToolChest.java
QueryToolChest.filterSegments
public <T extends LogicalSegment> List<T> filterSegments(QueryType query, List<T> segments) { return segments; }
java
public <T extends LogicalSegment> List<T> filterSegments(QueryType query, List<T> segments) { return segments; }
[ "public", "<", "T", "extends", "LogicalSegment", ">", "List", "<", "T", ">", "filterSegments", "(", "QueryType", "query", ",", "List", "<", "T", ">", "segments", ")", "{", "return", "segments", ";", "}" ]
This method is called to allow the query to prune segments that it does not believe need to actually be queried. It can use whatever criteria it wants in order to do the pruning, it just needs to return the list of Segments it actually wants to see queried. @param query The query being processed @param segments Th...
[ "This", "method", "is", "called", "to", "allow", "the", "query", "to", "prune", "segments", "that", "it", "does", "not", "believe", "need", "to", "actually", "be", "queried", ".", "It", "can", "use", "whatever", "criteria", "it", "wants", "in", "order", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/QueryToolChest.java#L218-L221
127,799
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/schema/DruidSchema.java
DruidSchema.refreshSegmentsForDataSource
private Set<DataSegment> refreshSegmentsForDataSource(final String dataSource, final Set<DataSegment> segments) throws IOException { log.debug("Refreshing metadata for dataSource[%s].", dataSource); final long startTime = System.currentTimeMillis(); // Segment id -> segment object. final Map<S...
java
private Set<DataSegment> refreshSegmentsForDataSource(final String dataSource, final Set<DataSegment> segments) throws IOException { log.debug("Refreshing metadata for dataSource[%s].", dataSource); final long startTime = System.currentTimeMillis(); // Segment id -> segment object. final Map<S...
[ "private", "Set", "<", "DataSegment", ">", "refreshSegmentsForDataSource", "(", "final", "String", "dataSource", ",", "final", "Set", "<", "DataSegment", ">", "segments", ")", "throws", "IOException", "{", "log", ".", "debug", "(", "\"Refreshing metadata for dataSou...
Attempt to refresh "segmentSignatures" for a set of segments for a particular dataSource. Returns the set of segments actually refreshed, which may be a subset of the asked-for set.
[ "Attempt", "to", "refresh", "segmentSignatures", "for", "a", "set", "of", "segments", "for", "a", "particular", "dataSource", ".", "Returns", "the", "set", "of", "segments", "actually", "refreshed", "which", "may", "be", "a", "subset", "of", "the", "asked", ...
f776b9408962b9006cfcfe4d6c1794751972cc8e
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/schema/DruidSchema.java#L480-L551