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,500 | grpc/grpc-java | okhttp/src/main/java/io/grpc/okhttp/OkHttpTlsUpgrader.java | OkHttpTlsUpgrader.canonicalizeHost | @VisibleForTesting
static String canonicalizeHost(String host) {
if (host.startsWith("[") && host.endsWith("]")) {
return host.substring(1, host.length() - 1);
}
return host;
} | java | @VisibleForTesting
static String canonicalizeHost(String host) {
if (host.startsWith("[") && host.endsWith("]")) {
return host.substring(1, host.length() - 1);
}
return host;
} | [
"@",
"VisibleForTesting",
"static",
"String",
"canonicalizeHost",
"(",
"String",
"host",
")",
"{",
"if",
"(",
"host",
".",
"startsWith",
"(",
"\"[\"",
")",
"&&",
"host",
".",
"endsWith",
"(",
"\"]\"",
")",
")",
"{",
"return",
"host",
".",
"substring",
"(... | Converts a host from URI to X509 format.
<p>IPv6 host addresses derived from URIs are enclosed in square brackets per RFC2732, but
omit these brackets in X509 certificate subjectAltName extensions per RFC5280.
@see <a href="https://www.ietf.org/rfc/rfc2732.txt">RFC2732</a>
@see <a href="https://tools.ietf.org/html/rf... | [
"Converts",
"a",
"host",
"from",
"URI",
"to",
"X509",
"format",
"."
] | 973885457f9609de232d2553b82c67f6c3ff57bf | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpTlsUpgrader.java#L90-L96 |
127,501 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/StringUtils.java | StringUtils.rpad | public static String rpad(String base, Integer len, String pad)
{
if (len < 0) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
int pos = 0;
// Copy the base
for ( ; pos < base.length() && pos < len; pos++) {
data[pos] = base.charAt(pos);... | java | public static String rpad(String base, Integer len, String pad)
{
if (len < 0) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
int pos = 0;
// Copy the base
for ( ; pos < base.length() && pos < len; pos++) {
data[pos] = base.charAt(pos);... | [
"public",
"static",
"String",
"rpad",
"(",
"String",
"base",
",",
"Integer",
"len",
",",
"String",
"pad",
")",
"{",
"if",
"(",
"len",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"\"\"",... | Returns the string right-padded with the string pad to a length of len characters.
If str is longer than len, the return value is shortened to len characters.
@param base The base string to be padded
@param len The length of padded string
@param pad The pad string
@return the string right-padded with pad to a length o... | [
"Returns",
"the",
"string",
"right",
"-",
"padded",
"with",
"the",
"string",
"pad",
"to",
"a",
"length",
"of",
"len",
"characters",
".",
"If",
"str",
"is",
"longer",
"than",
"len",
"the",
"return",
"value",
"is",
"shortened",
"to",
"len",
"characters",
"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/StringUtils.java#L463-L488 |
127,502 | apache/incubator-druid | extensions-core/lookups-cached-global/src/main/java/org/apache/druid/data/input/MapPopulator.java | MapPopulator.populate | public PopulateResult populate(final ByteSource source, final Map<K, V> map) throws IOException
{
return source.asCharSource(StandardCharsets.UTF_8).readLines(
new LineProcessor<PopulateResult>()
{
private int lines = 0;
private int entries = 0;
@Override
p... | java | public PopulateResult populate(final ByteSource source, final Map<K, V> map) throws IOException
{
return source.asCharSource(StandardCharsets.UTF_8).readLines(
new LineProcessor<PopulateResult>()
{
private int lines = 0;
private int entries = 0;
@Override
p... | [
"public",
"PopulateResult",
"populate",
"(",
"final",
"ByteSource",
"source",
",",
"final",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"throws",
"IOException",
"{",
"return",
"source",
".",
"asCharSource",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
".",
... | Read through the `source` line by line and populate `map` with the data returned from the `parser`
@param source The ByteSource to read lines from
@param map The map to populate
@return number of lines read and entries parsed
@throws IOException | [
"Read",
"through",
"the",
"source",
"line",
"by",
"line",
"and",
"populate",
"map",
"with",
"the",
"data",
"returned",
"from",
"the",
"parser"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/lookups-cached-global/src/main/java/org/apache/druid/data/input/MapPopulator.java#L80-L108 |
127,503 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CloseableUtils.java | CloseableUtils.closeBoth | public static void closeBoth(Closeable first, Closeable second) throws IOException
{
//noinspection EmptyTryBlock
try (Closeable ignore1 = second; Closeable ignore2 = first) {
// piggy-back try-with-resources semantics
}
} | java | public static void closeBoth(Closeable first, Closeable second) throws IOException
{
//noinspection EmptyTryBlock
try (Closeable ignore1 = second; Closeable ignore2 = first) {
// piggy-back try-with-resources semantics
}
} | [
"public",
"static",
"void",
"closeBoth",
"(",
"Closeable",
"first",
",",
"Closeable",
"second",
")",
"throws",
"IOException",
"{",
"//noinspection EmptyTryBlock",
"try",
"(",
"Closeable",
"ignore1",
"=",
"second",
";",
"Closeable",
"ignore2",
"=",
"first",
")",
... | Call method instead of code like
first.close();
second.close();
to have safety of {@link org.apache.druid.java.util.common.io.Closer}, but without associated boilerplate code
of creating a Closer and registering objects in it. | [
"Call",
"method",
"instead",
"of",
"code",
"like"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CloseableUtils.java#L40-L46 |
127,504 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/TimewarpOperator.java | TimewarpOperator.computeOffset | protected long computeOffset(final long t, final DateTimeZone tz)
{
// start is the beginning of the last period ending within dataInterval
long start = dataInterval.getEndMillis() - periodMillis;
long startOffset = start % periodMillis - originMillis % periodMillis;
if (startOffset < 0) {
start... | java | protected long computeOffset(final long t, final DateTimeZone tz)
{
// start is the beginning of the last period ending within dataInterval
long start = dataInterval.getEndMillis() - periodMillis;
long startOffset = start % periodMillis - originMillis % periodMillis;
if (startOffset < 0) {
start... | [
"protected",
"long",
"computeOffset",
"(",
"final",
"long",
"t",
",",
"final",
"DateTimeZone",
"tz",
")",
"{",
"// start is the beginning of the last period ending within dataInterval",
"long",
"start",
"=",
"dataInterval",
".",
"getEndMillis",
"(",
")",
"-",
"periodMil... | Map time t into the last `period` ending within `dataInterval`
@param t the current time to be mapped into `dataInterval`
@return the offset between the mapped time and time t | [
"Map",
"time",
"t",
"into",
"the",
"last",
"period",
"ending",
"within",
"dataInterval"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/TimewarpOperator.java#L148-L166 |
127,505 | apache/incubator-druid | server/src/main/java/org/apache/druid/client/DruidServer.java | DruidServer.iterateAllSegments | public Iterable<DataSegment> iterateAllSegments()
{
return () -> dataSources.values().stream().flatMap(dataSource -> dataSource.getSegments().stream()).iterator();
} | java | public Iterable<DataSegment> iterateAllSegments()
{
return () -> dataSources.values().stream().flatMap(dataSource -> dataSource.getSegments().stream()).iterator();
} | [
"public",
"Iterable",
"<",
"DataSegment",
">",
"iterateAllSegments",
"(",
")",
"{",
"return",
"(",
")",
"->",
"dataSources",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"dataSource",
"->",
"dataSource",
".",
"getSegments",
"(",
... | Returns an iterable to go over all segments in all data sources, stored on this DruidServer. The order in which
segments are iterated is unspecified.
Since this DruidServer can be mutated concurrently, the set of segments observed during an iteration may _not_ be
a momentary snapshot of the segments on the server, in ... | [
"Returns",
"an",
"iterable",
"to",
"go",
"over",
"all",
"segments",
"in",
"all",
"data",
"sources",
"stored",
"on",
"this",
"DruidServer",
".",
"The",
"order",
"in",
"which",
"segments",
"are",
"iterated",
"is",
"unspecified",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/DruidServer.java#L168-L171 |
127,506 | apache/incubator-druid | core/src/main/java/org/apache/druid/common/utils/ServletResourceUtils.java | ServletResourceUtils.jsonize | public static Map<String, String> jsonize(String msgFormat, Object... args)
{
return ImmutableMap.of("error", StringUtils.nonStrictFormat(msgFormat, args));
} | java | public static Map<String, String> jsonize(String msgFormat, Object... args)
{
return ImmutableMap.of("error", StringUtils.nonStrictFormat(msgFormat, args));
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"jsonize",
"(",
"String",
"msgFormat",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"ImmutableMap",
".",
"of",
"(",
"\"error\"",
",",
"StringUtils",
".",
"nonStrictFormat",
"(",
"msgFormat",
... | Converts String errorMsg into a Map so that it produces valid json on serialization into response. | [
"Converts",
"String",
"errorMsg",
"into",
"a",
"Map",
"so",
"that",
"it",
"produces",
"valid",
"json",
"on",
"serialization",
"into",
"response",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/common/utils/ServletResourceUtils.java#L48-L51 |
127,507 | apache/incubator-druid | extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisRecordSupplier.java | KinesisRecordSupplier.toByteArray | private static byte[] toByteArray(final ByteBuffer buffer)
{
if (buffer.hasArray()
&& buffer.arrayOffset() == 0
&& buffer.position() == 0
&& buffer.array().length == buffer.limit()) {
return buffer.array();
} else {
final byte[] retVal = new byte[buffer.remaining()];
... | java | private static byte[] toByteArray(final ByteBuffer buffer)
{
if (buffer.hasArray()
&& buffer.arrayOffset() == 0
&& buffer.position() == 0
&& buffer.array().length == buffer.limit()) {
return buffer.array();
} else {
final byte[] retVal = new byte[buffer.remaining()];
... | [
"private",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"final",
"ByteBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
"&&",
"buffer",
".",
"arrayOffset",
"(",
")",
"==",
"0",
"&&",
"buffer",
".",
"position",
"(",
")",
... | Returns an array with the content between the position and limit of "buffer". This may be the buffer's backing
array itself. Does not modify position or limit of the buffer. | [
"Returns",
"an",
"array",
"with",
"the",
"content",
"between",
"the",
"position",
"and",
"limit",
"of",
"buffer",
".",
"This",
"may",
"be",
"the",
"buffer",
"s",
"backing",
"array",
"itself",
".",
"Does",
"not",
"modify",
"position",
"or",
"limit",
"of",
... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisRecordSupplier.java#L763-L775 |
127,508 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java | DiskNormalizedCostBalancerStrategy.computeCost | @Override
protected double computeCost(
final DataSegment proposalSegment,
final ServerHolder server,
final boolean includeCurrentServer
)
{
double cost = super.computeCost(proposalSegment, server, includeCurrentServer);
if (cost == Double.POSITIVE_INFINITY) {
return cost;
}
... | java | @Override
protected double computeCost(
final DataSegment proposalSegment,
final ServerHolder server,
final boolean includeCurrentServer
)
{
double cost = super.computeCost(proposalSegment, server, includeCurrentServer);
if (cost == Double.POSITIVE_INFINITY) {
return cost;
}
... | [
"@",
"Override",
"protected",
"double",
"computeCost",
"(",
"final",
"DataSegment",
"proposalSegment",
",",
"final",
"ServerHolder",
"server",
",",
"final",
"boolean",
"includeCurrentServer",
")",
"{",
"double",
"cost",
"=",
"super",
".",
"computeCost",
"(",
"prop... | Averages the cost obtained from CostBalancerStrategy. Also the costs are weighted according to their usage ratios.
This ensures that all the hosts will have the same % disk utilization. | [
"Averages",
"the",
"cost",
"obtained",
"from",
"CostBalancerStrategy",
".",
"Also",
"the",
"costs",
"are",
"weighted",
"according",
"to",
"their",
"usage",
"ratios",
".",
"This",
"ensures",
"that",
"all",
"the",
"hosts",
"will",
"have",
"the",
"same",
"%",
"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java#L36-L58 |
127,509 | apache/incubator-druid | extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosUtil.java | DruidKerberosUtil.kerberosChallenge | public static String kerberosChallenge(String server) throws AuthenticationException
{
kerberosLock.lock();
try {
// This Oid for Kerberos GSS-API mechanism.
Oid mechOid = KerberosUtil.getOidInstance("GSS_KRB5_MECH_OID");
GSSManager manager = GSSManager.getInstance();
// GSS name for s... | java | public static String kerberosChallenge(String server) throws AuthenticationException
{
kerberosLock.lock();
try {
// This Oid for Kerberos GSS-API mechanism.
Oid mechOid = KerberosUtil.getOidInstance("GSS_KRB5_MECH_OID");
GSSManager manager = GSSManager.getInstance();
// GSS name for s... | [
"public",
"static",
"String",
"kerberosChallenge",
"(",
"String",
"server",
")",
"throws",
"AuthenticationException",
"{",
"kerberosLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// This Oid for Kerberos GSS-API mechanism.",
"Oid",
"mechOid",
"=",
"KerberosUtil",
"."... | This method always needs to be called within a doAs block so that the client's TGT credentials
can be read from the Subject.
@return Kerberos Challenge String
@throws Exception | [
"This",
"method",
"always",
"needs",
"to",
"be",
"called",
"within",
"a",
"doAs",
"block",
"so",
"that",
"the",
"client",
"s",
"TGT",
"credentials",
"can",
"be",
"read",
"from",
"the",
"Subject",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosUtil.java#L62-L90 |
127,510 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQueryRel.java | DruidQueryRel.fullScan | public static DruidQueryRel fullScan(
final LogicalTableScan scanRel,
final RelOptTable table,
final DruidTable druidTable,
final QueryMaker queryMaker
)
{
return new DruidQueryRel(
scanRel.getCluster(),
scanRel.getCluster().traitSetOf(Convention.NONE),
table,
... | java | public static DruidQueryRel fullScan(
final LogicalTableScan scanRel,
final RelOptTable table,
final DruidTable druidTable,
final QueryMaker queryMaker
)
{
return new DruidQueryRel(
scanRel.getCluster(),
scanRel.getCluster().traitSetOf(Convention.NONE),
table,
... | [
"public",
"static",
"DruidQueryRel",
"fullScan",
"(",
"final",
"LogicalTableScan",
"scanRel",
",",
"final",
"RelOptTable",
"table",
",",
"final",
"DruidTable",
"druidTable",
",",
"final",
"QueryMaker",
"queryMaker",
")",
"{",
"return",
"new",
"DruidQueryRel",
"(",
... | Create a DruidQueryRel representing a full scan. | [
"Create",
"a",
"DruidQueryRel",
"representing",
"a",
"full",
"scan",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQueryRel.java#L76-L91 |
127,511 | apache/incubator-druid | hll/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java | HyperLogLogCollector.makeCollector | public static HyperLogLogCollector makeCollector(ByteBuffer buffer)
{
int remaining = buffer.remaining();
if (remaining % 3 == 0 || remaining == 1027) {
return new VersionZeroHyperLogLogCollector(buffer);
} else {
return new VersionOneHyperLogLogCollector(buffer);
}
} | java | public static HyperLogLogCollector makeCollector(ByteBuffer buffer)
{
int remaining = buffer.remaining();
if (remaining % 3 == 0 || remaining == 1027) {
return new VersionZeroHyperLogLogCollector(buffer);
} else {
return new VersionOneHyperLogLogCollector(buffer);
}
} | [
"public",
"static",
"HyperLogLogCollector",
"makeCollector",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"int",
"remaining",
"=",
"buffer",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"remaining",
"%",
"3",
"==",
"0",
"||",
"remaining",
"==",
"1027",
")",
"{",
... | Create a wrapper object around an HLL sketch contained within a buffer. The position and limit of
the buffer may be changed; if you do not want this to happen, you can duplicate the buffer before
passing it in.
The mark and byte order of the buffer will not be modified.
@param buffer buffer containing an HLL sketch s... | [
"Create",
"a",
"wrapper",
"object",
"around",
"an",
"HLL",
"sketch",
"contained",
"within",
"a",
"buffer",
".",
"The",
"position",
"and",
"limit",
"of",
"the",
"buffer",
"may",
"be",
"changed",
";",
"if",
"you",
"do",
"not",
"want",
"this",
"to",
"happen... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/hll/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java#L110-L118 |
127,512 | apache/incubator-druid | hll/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java | HyperLogLogCollector.mergeAndStoreByteRegister | private static short mergeAndStoreByteRegister(
final ByteBuffer storageBuffer,
final int position,
final int offsetDiff,
final byte byteToAdd
)
{
if (byteToAdd == 0) {
return 0;
}
final byte currVal = storageBuffer.get(position);
final int upperNibble = currVal & 0xf... | java | private static short mergeAndStoreByteRegister(
final ByteBuffer storageBuffer,
final int position,
final int offsetDiff,
final byte byteToAdd
)
{
if (byteToAdd == 0) {
return 0;
}
final byte currVal = storageBuffer.get(position);
final int upperNibble = currVal & 0xf... | [
"private",
"static",
"short",
"mergeAndStoreByteRegister",
"(",
"final",
"ByteBuffer",
"storageBuffer",
",",
"final",
"int",
"position",
",",
"final",
"int",
"offsetDiff",
",",
"final",
"byte",
"byteToAdd",
")",
"{",
"if",
"(",
"byteToAdd",
"==",
"0",
")",
"{"... | Returns the number of registers that are no longer zero after the value was added
@param position The position into the byte buffer, this position represents two "registers"
@param offsetDiff The difference in offset between the byteToAdd and the current HyperLogLogCollector
@param byteToAdd The byte to merge into ... | [
"Returns",
"the",
"number",
"of",
"registers",
"that",
"are",
"no",
"longer",
"zero",
"after",
"the",
"value",
"was",
"added"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/hll/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java#L698-L732 |
127,513 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java | IndexTaskUtils.datasourceAuthorizationCheck | public static Access datasourceAuthorizationCheck(
final HttpServletRequest req,
Action action,
String datasource,
AuthorizerMapper authorizerMapper
)
{
ResourceAction resourceAction = new ResourceAction(
new Resource(datasource, ResourceType.DATASOURCE),
action
);
... | java | public static Access datasourceAuthorizationCheck(
final HttpServletRequest req,
Action action,
String datasource,
AuthorizerMapper authorizerMapper
)
{
ResourceAction resourceAction = new ResourceAction(
new Resource(datasource, ResourceType.DATASOURCE),
action
);
... | [
"public",
"static",
"Access",
"datasourceAuthorizationCheck",
"(",
"final",
"HttpServletRequest",
"req",
",",
"Action",
"action",
",",
"String",
"datasource",
",",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"ResourceAction",
"resourceAction",
"=",
"new",
"Resourc... | Authorizes action to be performed on a task's datasource
@return authorization result | [
"Authorizes",
"action",
"to",
"be",
"performed",
"on",
"a",
"task",
"s",
"datasource"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java#L62-L80 |
127,514 | apache/incubator-druid | server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java | LookupReferencesManager.getAllLookupsState | LookupsState<LookupExtractorFactoryContainer> getAllLookupsState()
{
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
LookupUpdateState lookupUpdateState = stateRef.get();
Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>();
Set<String> lookups... | java | LookupsState<LookupExtractorFactoryContainer> getAllLookupsState()
{
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
LookupUpdateState lookupUpdateState = stateRef.get();
Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>();
Set<String> lookups... | [
"LookupsState",
"<",
"LookupExtractorFactoryContainer",
">",
"getAllLookupsState",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"lifecycleLock",
".",
"awaitStarted",
"(",
"1",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
")",
";",
"LookupUpdateState",
"look... | Note that this should ensure that "toLoad" and "toDrop" are disjoint. | [
"Note",
"that",
"this",
"should",
"ensure",
"that",
"toLoad",
"and",
"toDrop",
"are",
"disjoint",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java#L305-L318 |
127,515 | apache/incubator-druid | server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java | LookupReferencesManager.getLookupsList | @Nullable
private List<LookupBean> getLookupsList()
{
List<LookupBean> lookupBeanList;
if (lookupConfig.getEnableLookupSyncOnStartup()) {
lookupBeanList = getLookupListFromCoordinator(lookupListeningAnnouncerConfig.getLookupTier());
if (lookupBeanList == null) {
LOG.info("Coordinator is ... | java | @Nullable
private List<LookupBean> getLookupsList()
{
List<LookupBean> lookupBeanList;
if (lookupConfig.getEnableLookupSyncOnStartup()) {
lookupBeanList = getLookupListFromCoordinator(lookupListeningAnnouncerConfig.getLookupTier());
if (lookupBeanList == null) {
LOG.info("Coordinator is ... | [
"@",
"Nullable",
"private",
"List",
"<",
"LookupBean",
">",
"getLookupsList",
"(",
")",
"{",
"List",
"<",
"LookupBean",
">",
"lookupBeanList",
";",
"if",
"(",
"lookupConfig",
".",
"getEnableLookupSyncOnStartup",
"(",
")",
")",
"{",
"lookupBeanList",
"=",
"getL... | Gets the lookup list from coordinator or from snapshot. | [
"Gets",
"the",
"lookup",
"list",
"from",
"coordinator",
"or",
"from",
"snapshot",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java#L362-L376 |
127,516 | apache/incubator-druid | server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java | LookupReferencesManager.getLookupListFromCoordinator | @Nullable
private List<LookupBean> getLookupListFromCoordinator(String tier)
{
try {
MutableBoolean firstAttempt = new MutableBoolean(true);
Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry(
() -> {
if (firstAttempt.isTrue()) {
firstAttemp... | java | @Nullable
private List<LookupBean> getLookupListFromCoordinator(String tier)
{
try {
MutableBoolean firstAttempt = new MutableBoolean(true);
Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry(
() -> {
if (firstAttempt.isTrue()) {
firstAttemp... | [
"@",
"Nullable",
"private",
"List",
"<",
"LookupBean",
">",
"getLookupListFromCoordinator",
"(",
"String",
"tier",
")",
"{",
"try",
"{",
"MutableBoolean",
"firstAttempt",
"=",
"new",
"MutableBoolean",
"(",
"true",
")",
";",
"Map",
"<",
"String",
",",
"LookupEx... | Returns a list of lookups from the coordinator if the coordinator is available. If it's not available, returns null.
@param tier lookup tier name
@return list of LookupBean objects, or null | [
"Returns",
"a",
"list",
"of",
"lookups",
"from",
"the",
"coordinator",
"if",
"the",
"coordinator",
"is",
"available",
".",
"If",
"it",
"s",
"not",
"available",
"returns",
"null",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java#L385-L417 |
127,517 | apache/incubator-druid | server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java | LookupReferencesManager.getLookupListFromSnapshot | @Nullable
private List<LookupBean> getLookupListFromSnapshot()
{
if (lookupSnapshotTaker != null) {
return lookupSnapshotTaker.pullExistingSnapshot(lookupListeningAnnouncerConfig.getLookupTier());
}
return null;
} | java | @Nullable
private List<LookupBean> getLookupListFromSnapshot()
{
if (lookupSnapshotTaker != null) {
return lookupSnapshotTaker.pullExistingSnapshot(lookupListeningAnnouncerConfig.getLookupTier());
}
return null;
} | [
"@",
"Nullable",
"private",
"List",
"<",
"LookupBean",
">",
"getLookupListFromSnapshot",
"(",
")",
"{",
"if",
"(",
"lookupSnapshotTaker",
"!=",
"null",
")",
"{",
"return",
"lookupSnapshotTaker",
".",
"pullExistingSnapshot",
"(",
"lookupListeningAnnouncerConfig",
".",
... | Returns a list of lookups from the snapshot if the lookupsnapshottaker is configured. If it's not available,
returns null.
@return list of LookupBean objects, or null | [
"Returns",
"a",
"list",
"of",
"lookups",
"from",
"the",
"snapshot",
"if",
"the",
"lookupsnapshottaker",
"is",
"configured",
".",
"If",
"it",
"s",
"not",
"available",
"returns",
"null",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java#L455-L462 |
127,518 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/column/DoublesColumn.java | DoublesColumn.create | public static DoublesColumn create(ColumnarDoubles column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new DoublesColumn(column);
} else {
return new DoublesColumnWithNulls(column, nullValueBitmap);
}
} | java | public static DoublesColumn create(ColumnarDoubles column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new DoublesColumn(column);
} else {
return new DoublesColumnWithNulls(column, nullValueBitmap);
}
} | [
"public",
"static",
"DoublesColumn",
"create",
"(",
"ColumnarDoubles",
"column",
",",
"ImmutableBitmap",
"nullValueBitmap",
")",
"{",
"if",
"(",
"nullValueBitmap",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"DoublesColumn",
"(",
"column",
")",
";",
"... | Factory method to create DoublesColumn. | [
"Factory",
"method",
"to",
"create",
"DoublesColumn",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/column/DoublesColumn.java#L37-L44 |
127,519 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/WorkerSelectUtils.java | WorkerSelectUtils.getNonAffinityWorkers | private static ImmutableMap<String, ImmutableWorkerInfo> getNonAffinityWorkers(
final AffinityConfig affinityConfig,
final Map<String, ImmutableWorkerInfo> workerMap
)
{
return ImmutableMap.copyOf(
Maps.filterKeys(
workerMap,
workerHost -> !affinityConfig.getAffinityW... | java | private static ImmutableMap<String, ImmutableWorkerInfo> getNonAffinityWorkers(
final AffinityConfig affinityConfig,
final Map<String, ImmutableWorkerInfo> workerMap
)
{
return ImmutableMap.copyOf(
Maps.filterKeys(
workerMap,
workerHost -> !affinityConfig.getAffinityW... | [
"private",
"static",
"ImmutableMap",
"<",
"String",
",",
"ImmutableWorkerInfo",
">",
"getNonAffinityWorkers",
"(",
"final",
"AffinityConfig",
"affinityConfig",
",",
"final",
"Map",
"<",
"String",
",",
"ImmutableWorkerInfo",
">",
"workerMap",
")",
"{",
"return",
"Imm... | Return workers not assigned to any affinity pool at all.
@param affinityConfig affinity config
@param workerMap map of worker hostname to worker info
@return map of worker hostname to worker info | [
"Return",
"workers",
"not",
"assigned",
"to",
"any",
"affinity",
"pool",
"at",
"all",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/WorkerSelectUtils.java#L106-L117 |
127,520 | apache/incubator-druid | core/src/main/java/org/apache/druid/concurrent/TaskThreadPriority.java | TaskThreadPriority.getThreadPriorityFromTaskPriority | public static Integer getThreadPriorityFromTaskPriority(final int taskPriority)
{
if (taskPriority == 0) {
return null;
}
int finalPriority = taskPriority + Thread.NORM_PRIORITY;
if (taskPriority > Thread.MAX_PRIORITY) {
return Thread.MAX_PRIORITY;
}
if (finalPriority < Thread.MIN_... | java | public static Integer getThreadPriorityFromTaskPriority(final int taskPriority)
{
if (taskPriority == 0) {
return null;
}
int finalPriority = taskPriority + Thread.NORM_PRIORITY;
if (taskPriority > Thread.MAX_PRIORITY) {
return Thread.MAX_PRIORITY;
}
if (finalPriority < Thread.MIN_... | [
"public",
"static",
"Integer",
"getThreadPriorityFromTaskPriority",
"(",
"final",
"int",
"taskPriority",
")",
"{",
"if",
"(",
"taskPriority",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"int",
"finalPriority",
"=",
"taskPriority",
"+",
"Thread",
".",
"NOR... | Return the thread-factory friendly priorities from the task priority
@param taskPriority The priority for the task. >0 means high. 0 means inherit from current thread, <0 means low.
@return The thread priority to use in a thread factory, or null if no priority is to be set | [
"Return",
"the",
"thread",
"-",
"factory",
"friendly",
"priorities",
"from",
"the",
"task",
"priority"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/TaskThreadPriority.java#L54-L67 |
127,521 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java | TaskMonitor.stop | public void stop()
{
synchronized (startStopLock) {
running = false;
taskStatusChecker.shutdownNow();
if (numRunningTasks > 0) {
final Iterator<MonitorEntry> iterator = runningTasks.values().iterator();
while (iterator.hasNext()) {
final MonitorEntry entry = iterator.n... | java | public void stop()
{
synchronized (startStopLock) {
running = false;
taskStatusChecker.shutdownNow();
if (numRunningTasks > 0) {
final Iterator<MonitorEntry> iterator = runningTasks.values().iterator();
while (iterator.hasNext()) {
final MonitorEntry entry = iterator.n... | [
"public",
"void",
"stop",
"(",
")",
"{",
"synchronized",
"(",
"startStopLock",
")",
"{",
"running",
"=",
"false",
";",
"taskStatusChecker",
".",
"shutdownNow",
"(",
")",
";",
"if",
"(",
"numRunningTasks",
">",
"0",
")",
"{",
"final",
"Iterator",
"<",
"Mo... | Stop task monitoring and kill all running tasks. | [
"Stop",
"task",
"monitoring",
"and",
"kill",
"all",
"running",
"tasks",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java#L181-L209 |
127,522 | apache/incubator-druid | core/src/main/java/org/apache/druid/collections/CombiningIterable.java | CombiningIterable.createSplatted | @SuppressWarnings("unchecked")
public static <InType> CombiningIterable<InType> createSplatted(
Iterable<? extends Iterable<InType>> in,
Comparator<InType> comparator
)
{
return create(
new MergeIterable<InType>(comparator, (Iterable<Iterable<InType>>) in),
comparator,
new ... | java | @SuppressWarnings("unchecked")
public static <InType> CombiningIterable<InType> createSplatted(
Iterable<? extends Iterable<InType>> in,
Comparator<InType> comparator
)
{
return create(
new MergeIterable<InType>(comparator, (Iterable<Iterable<InType>>) in),
comparator,
new ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"InType",
">",
"CombiningIterable",
"<",
"InType",
">",
"createSplatted",
"(",
"Iterable",
"<",
"?",
"extends",
"Iterable",
"<",
"InType",
">",
">",
"in",
",",
"Comparator",
"<",
"I... | Creates a CombiningIterable around a MergeIterable such that equivalent elements are thrown away
If there are multiple Iterables in parameter "in" with equivalent objects, there are no guarantees
around which object will win. You will get *some* object from one of the Iterables, but which Iterable is
unknown.
@param... | [
"Creates",
"a",
"CombiningIterable",
"around",
"a",
"MergeIterable",
"such",
"that",
"equivalent",
"elements",
"are",
"thrown",
"away"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/collections/CombiningIterable.java#L45-L66 |
127,523 | apache/incubator-druid | server/src/main/java/org/apache/druid/client/ImmutableDruidServer.java | ImmutableDruidServer.getLazyAllSegments | public Collection<DataSegment> getLazyAllSegments()
{
return CollectionUtils.createLazyCollectionFromStream(
() -> dataSources.values().stream().flatMap(dataSource -> dataSource.getSegments().stream()),
totalSegments
);
} | java | public Collection<DataSegment> getLazyAllSegments()
{
return CollectionUtils.createLazyCollectionFromStream(
() -> dataSources.values().stream().flatMap(dataSource -> dataSource.getSegments().stream()),
totalSegments
);
} | [
"public",
"Collection",
"<",
"DataSegment",
">",
"getLazyAllSegments",
"(",
")",
"{",
"return",
"CollectionUtils",
".",
"createLazyCollectionFromStream",
"(",
"(",
")",
"->",
"dataSources",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",... | Returns a lazy collection with all segments in all data sources, stored on this ImmutableDruidServer. The order
of segments in this collection is unspecified.
Calling {@link Collection#size()} on the returned collection is cheap, O(1).
Note: iteration over the returned collection may not be as trivially cheap as, for... | [
"Returns",
"a",
"lazy",
"collection",
"with",
"all",
"segments",
"in",
"all",
"data",
"sources",
"stored",
"on",
"this",
"ImmutableDruidServer",
".",
"The",
"order",
"of",
"segments",
"in",
"this",
"collection",
"is",
"unspecified",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/ImmutableDruidServer.java#L140-L146 |
127,524 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java | DruidMeta.getDruidConnection | @Nonnull
private DruidConnection getDruidConnection(final String connectionId)
{
final DruidConnection connection = connections.get(connectionId);
if (connection == null) {
throw new NoSuchConnectionException(connectionId);
}
return connection.sync(
exec.schedule(
() -> {... | java | @Nonnull
private DruidConnection getDruidConnection(final String connectionId)
{
final DruidConnection connection = connections.get(connectionId);
if (connection == null) {
throw new NoSuchConnectionException(connectionId);
}
return connection.sync(
exec.schedule(
() -> {... | [
"@",
"Nonnull",
"private",
"DruidConnection",
"getDruidConnection",
"(",
"final",
"String",
"connectionId",
")",
"{",
"final",
"DruidConnection",
"connection",
"=",
"connections",
".",
"get",
"(",
"connectionId",
")",
";",
"if",
"(",
"connection",
"==",
"null",
... | Get a connection, or throw an exception if it doesn't exist. Also refreshes the timeout timer.
@param connectionId connection id
@return the connection
@throws NoSuchConnectionException if the connection id doesn't exist | [
"Get",
"a",
"connection",
"or",
"throw",
"an",
"exception",
"if",
"it",
"doesn",
"t",
"exist",
".",
"Also",
"refreshes",
"the",
"timeout",
"timer",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java#L579-L598 |
127,525 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java | ChangeRequestHttpSyncer.getDebugInfo | public Map<String, Object> getDebugInfo()
{
long currTime = System.currentTimeMillis();
Object notSuccessfullySyncedFor;
if (lastSuccessfulSyncTime == 0) {
notSuccessfullySyncedFor = "Never Successfully Synced";
} else {
notSuccessfullySyncedFor = (currTime - lastSuccessfulSyncTime) / 100... | java | public Map<String, Object> getDebugInfo()
{
long currTime = System.currentTimeMillis();
Object notSuccessfullySyncedFor;
if (lastSuccessfulSyncTime == 0) {
notSuccessfullySyncedFor = "Never Successfully Synced";
} else {
notSuccessfullySyncedFor = (currTime - lastSuccessfulSyncTime) / 100... | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getDebugInfo",
"(",
")",
"{",
"long",
"currTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Object",
"notSuccessfullySyncedFor",
";",
"if",
"(",
"lastSuccessfulSyncTime",
"==",
"0",
")",
"{"... | This method returns the debugging information for printing, must not be used for any other purpose. | [
"This",
"method",
"returns",
"the",
"debugging",
"information",
"for",
"printing",
"must",
"not",
"be",
"used",
"for",
"any",
"other",
"purpose",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java#L153-L169 |
127,526 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java | WorkerTaskMonitor.start | @LifecycleStart
@Override
public void start() throws Exception
{
super.start();
synchronized (lifecycleLock) {
Preconditions.checkState(!started, "already started");
started = true;
try {
cleanupStaleAnnouncements();
registerRunListener();
pathChildrenCache.star... | java | @LifecycleStart
@Override
public void start() throws Exception
{
super.start();
synchronized (lifecycleLock) {
Preconditions.checkState(!started, "already started");
started = true;
try {
cleanupStaleAnnouncements();
registerRunListener();
pathChildrenCache.star... | [
"@",
"LifecycleStart",
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"start",
"(",
")",
";",
"synchronized",
"(",
"lifecycleLock",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"started",
",",
"\"... | Register a monitor for new tasks. When new tasks appear, the worker node announces a status to indicate it has
started the task. When the task is complete, the worker node updates the status. | [
"Register",
"a",
"monitor",
"for",
"new",
"tasks",
".",
"When",
"new",
"tasks",
"appear",
"the",
"worker",
"node",
"announces",
"a",
"status",
"to",
"indicate",
"it",
"has",
"started",
"the",
"task",
".",
"When",
"the",
"task",
"is",
"complete",
"the",
"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java#L90-L117 |
127,527 | apache/incubator-druid | server/src/main/java/org/apache/druid/client/cache/CaffeineCache.java | CaffeineCache.create | public static CaffeineCache create(final CaffeineCacheConfig config, final Executor executor)
{
Caffeine<Object, Object> builder = Caffeine.newBuilder().recordStats();
if (config.getExpireAfter() >= 0) {
builder
.expireAfterAccess(config.getExpireAfter(), TimeUnit.MILLISECONDS);
}
if (... | java | public static CaffeineCache create(final CaffeineCacheConfig config, final Executor executor)
{
Caffeine<Object, Object> builder = Caffeine.newBuilder().recordStats();
if (config.getExpireAfter() >= 0) {
builder
.expireAfterAccess(config.getExpireAfter(), TimeUnit.MILLISECONDS);
}
if (... | [
"public",
"static",
"CaffeineCache",
"create",
"(",
"final",
"CaffeineCacheConfig",
"config",
",",
"final",
"Executor",
"executor",
")",
"{",
"Caffeine",
"<",
"Object",
",",
"Object",
">",
"builder",
"=",
"Caffeine",
".",
"newBuilder",
"(",
")",
".",
"recordSt... | Used in testing | [
"Used",
"in",
"testing"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/cache/CaffeineCache.java#L63-L82 |
127,528 | apache/incubator-druid | server/src/main/java/org/apache/druid/client/cache/CaffeineCache.java | CaffeineCache.close | @Override
public void close(String namespace)
{
if (config.isEvictOnClose()) {
cache.asMap().keySet().removeIf(key -> key.namespace.equals(namespace));
}
} | java | @Override
public void close(String namespace)
{
if (config.isEvictOnClose()) {
cache.asMap().keySet().removeIf(key -> key.namespace.equals(namespace));
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
"String",
"namespace",
")",
"{",
"if",
"(",
"config",
".",
"isEvictOnClose",
"(",
")",
")",
"{",
"cache",
".",
"asMap",
"(",
")",
".",
"keySet",
"(",
")",
".",
"removeIf",
"(",
"key",
"->",
"key",
".... | This is completely racy with put. Any values missed should be evicted later anyways. So no worries. | [
"This",
"is",
"completely",
"racy",
"with",
"put",
".",
"Any",
"values",
"missed",
"should",
"be",
"evicted",
"later",
"anyways",
".",
"So",
"no",
"worries",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/cache/CaffeineCache.java#L111-L117 |
127,529 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.authorizeResourceAction | public static Access authorizeResourceAction(
final HttpServletRequest request,
final ResourceAction resourceAction,
final AuthorizerMapper authorizerMapper
)
{
return authorizeAllResourceActions(
request,
Collections.singletonList(resourceAction),
authorizerMapper
... | java | public static Access authorizeResourceAction(
final HttpServletRequest request,
final ResourceAction resourceAction,
final AuthorizerMapper authorizerMapper
)
{
return authorizeAllResourceActions(
request,
Collections.singletonList(resourceAction),
authorizerMapper
... | [
"public",
"static",
"Access",
"authorizeResourceAction",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"ResourceAction",
"resourceAction",
",",
"final",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"return",
"authorizeAllResourceActions",
"(",
"request",... | Check a resource-action using the authorization fields from the request.
Otherwise, if the resource-actions is authorized, return ACCESS_OK.
This function will set the DRUID_AUTHORIZATION_CHECKED attribute in the request.
If this attribute is already set when this function is called, an exception is thrown.
@param ... | [
"Check",
"a",
"resource",
"-",
"action",
"using",
"the",
"authorization",
"fields",
"from",
"the",
"request",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L55-L66 |
127,530 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.authenticationResultFromRequest | public static AuthenticationResult authenticationResultFromRequest(final HttpServletRequest request)
{
final AuthenticationResult authenticationResult = (AuthenticationResult) request.getAttribute(
AuthConfig.DRUID_AUTHENTICATION_RESULT
);
if (authenticationResult == null) {
throw new ISE("... | java | public static AuthenticationResult authenticationResultFromRequest(final HttpServletRequest request)
{
final AuthenticationResult authenticationResult = (AuthenticationResult) request.getAttribute(
AuthConfig.DRUID_AUTHENTICATION_RESULT
);
if (authenticationResult == null) {
throw new ISE("... | [
"public",
"static",
"AuthenticationResult",
"authenticationResultFromRequest",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"final",
"AuthenticationResult",
"authenticationResult",
"=",
"(",
"AuthenticationResult",
")",
"request",
".",
"getAttribute",
"(",
"Auth... | Returns the authentication information for a request.
@param request http request
@return authentication result
@throws IllegalStateException if the request was not authenticated | [
"Returns",
"the",
"authentication",
"information",
"for",
"a",
"request",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L77-L88 |
127,531 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.authorizeAllResourceActions | public static Access authorizeAllResourceActions(
final AuthenticationResult authenticationResult,
final Iterable<ResourceAction> resourceActions,
final AuthorizerMapper authorizerMapper
)
{
final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName());... | java | public static Access authorizeAllResourceActions(
final AuthenticationResult authenticationResult,
final Iterable<ResourceAction> resourceActions,
final AuthorizerMapper authorizerMapper
)
{
final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName());... | [
"public",
"static",
"Access",
"authorizeAllResourceActions",
"(",
"final",
"AuthenticationResult",
"authenticationResult",
",",
"final",
"Iterable",
"<",
"ResourceAction",
">",
"resourceActions",
",",
"final",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"final",
"Au... | Check a list of resource-actions to be performed by the identity represented by authenticationResult.
If one of the resource-actions fails the authorization check, this method returns the failed
Access object from the check.
Otherwise, return ACCESS_OK if all resource-actions were successfully authorized.
@param aut... | [
"Check",
"a",
"list",
"of",
"resource",
"-",
"actions",
"to",
"be",
"performed",
"by",
"the",
"identity",
"represented",
"by",
"authenticationResult",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L103-L134 |
127,532 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.authorizeAllResourceActions | public static Access authorizeAllResourceActions(
final HttpServletRequest request,
final Iterable<ResourceAction> resourceActions,
final AuthorizerMapper authorizerMapper
)
{
if (request.getAttribute(AuthConfig.DRUID_ALLOW_UNSECURED_PATH) != null) {
return Access.OK;
}
if (requ... | java | public static Access authorizeAllResourceActions(
final HttpServletRequest request,
final Iterable<ResourceAction> resourceActions,
final AuthorizerMapper authorizerMapper
)
{
if (request.getAttribute(AuthConfig.DRUID_ALLOW_UNSECURED_PATH) != null) {
return Access.OK;
}
if (requ... | [
"public",
"static",
"Access",
"authorizeAllResourceActions",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Iterable",
"<",
"ResourceAction",
">",
"resourceActions",
",",
"final",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"if",
"(",
"request",
"... | Check a list of resource-actions to be performed as a result of an HTTP request.
If one of the resource-actions fails the authorization check, this method returns the failed
Access object from the check.
Otherwise, return ACCESS_OK if all resource-actions were successfully authorized.
This function will set the DRUI... | [
"Check",
"a",
"list",
"of",
"resource",
"-",
"actions",
"to",
"be",
"performed",
"as",
"a",
"result",
"of",
"an",
"HTTP",
"request",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L153-L175 |
127,533 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.filterAuthorizedResources | public static <KeyType, ResType> Map<KeyType, List<ResType>> filterAuthorizedResources(
final HttpServletRequest request,
final Map<KeyType, List<ResType>> unfilteredResources,
final Function<? super ResType, Iterable<ResourceAction>> resourceActionGenerator,
final AuthorizerMapper authorizerMap... | java | public static <KeyType, ResType> Map<KeyType, List<ResType>> filterAuthorizedResources(
final HttpServletRequest request,
final Map<KeyType, List<ResType>> unfilteredResources,
final Function<? super ResType, Iterable<ResourceAction>> resourceActionGenerator,
final AuthorizerMapper authorizerMap... | [
"public",
"static",
"<",
"KeyType",
",",
"ResType",
">",
"Map",
"<",
"KeyType",
",",
"List",
"<",
"ResType",
">",
">",
"filterAuthorizedResources",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Map",
"<",
"KeyType",
",",
"List",
"<",
"ResType... | Given a map of resource lists, filter each resources list by applying the resource action generator to each
item in each resource list.
The resourceActionGenerator returns an Iterable<ResourceAction> for each resource.
If a resource list is null or has no authorized items after filtering, it will not be included in t... | [
"Given",
"a",
"map",
"of",
"resource",
"lists",
"filter",
"each",
"resources",
"list",
"by",
"applying",
"the",
"resource",
"action",
"generator",
"to",
"each",
"item",
"in",
"each",
"resource",
"list",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L314-L357 |
127,534 | apache/incubator-druid | core/src/main/java/org/apache/druid/data/input/impl/TimestampSpec.java | TimestampSpec.mergeTimestampSpec | public static TimestampSpec mergeTimestampSpec(List<TimestampSpec> toMerge)
{
if (toMerge == null || toMerge.size() == 0) {
return null;
}
TimestampSpec result = toMerge.get(0);
for (int i = 1; i < toMerge.size(); i++) {
if (toMerge.get(i) == null) {
continue;
}
if (!O... | java | public static TimestampSpec mergeTimestampSpec(List<TimestampSpec> toMerge)
{
if (toMerge == null || toMerge.size() == 0) {
return null;
}
TimestampSpec result = toMerge.get(0);
for (int i = 1; i < toMerge.size(); i++) {
if (toMerge.get(i) == null) {
continue;
}
if (!O... | [
"public",
"static",
"TimestampSpec",
"mergeTimestampSpec",
"(",
"List",
"<",
"TimestampSpec",
">",
"toMerge",
")",
"{",
"if",
"(",
"toMerge",
"==",
"null",
"||",
"toMerge",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"Timestam... | returns null. this can be improved in future but is good enough for most use-cases. | [
"returns",
"null",
".",
"this",
"can",
"be",
"improved",
"in",
"future",
"but",
"is",
"good",
"enough",
"for",
"most",
"use",
"-",
"cases",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/data/input/impl/TimestampSpec.java#L159-L176 |
127,535 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/column/LongsColumn.java | LongsColumn.create | public static LongsColumn create(ColumnarLongs column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new LongsColumn(column);
} else {
return new LongsColumnWithNulls(column, nullValueBitmap);
}
} | java | public static LongsColumn create(ColumnarLongs column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new LongsColumn(column);
} else {
return new LongsColumnWithNulls(column, nullValueBitmap);
}
} | [
"public",
"static",
"LongsColumn",
"create",
"(",
"ColumnarLongs",
"column",
",",
"ImmutableBitmap",
"nullValueBitmap",
")",
"{",
"if",
"(",
"nullValueBitmap",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"LongsColumn",
"(",
"column",
")",
";",
"}",
... | Factory method to create LongsColumn. | [
"Factory",
"method",
"to",
"create",
"LongsColumn",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/column/LongsColumn.java#L36-L43 |
127,536 | apache/incubator-druid | server/src/main/java/org/apache/druid/curator/CuratorUtils.java | CuratorUtils.createIfNotExists | public static void createIfNotExists(
CuratorFramework curatorFramework,
String path,
CreateMode mode,
byte[] rawBytes,
int maxZnodeBytes
) throws Exception
{
verifySize(path, rawBytes, maxZnodeBytes);
if (curatorFramework.checkExists().forPath(path) == null) {
try {
... | java | public static void createIfNotExists(
CuratorFramework curatorFramework,
String path,
CreateMode mode,
byte[] rawBytes,
int maxZnodeBytes
) throws Exception
{
verifySize(path, rawBytes, maxZnodeBytes);
if (curatorFramework.checkExists().forPath(path) == null) {
try {
... | [
"public",
"static",
"void",
"createIfNotExists",
"(",
"CuratorFramework",
"curatorFramework",
",",
"String",
"path",
",",
"CreateMode",
"mode",
",",
"byte",
"[",
"]",
"rawBytes",
",",
"int",
"maxZnodeBytes",
")",
"throws",
"Exception",
"{",
"verifySize",
"(",
"p... | Create znode if it does not already exist. If it does already exist, this does nothing. In particular, the
existing znode may have a different payload or create mode.
@param curatorFramework curator
@param path path
@param mode create mode
@param rawBytes payload
@param maxZnodeBytes ... | [
"Create",
"znode",
"if",
"it",
"does",
"not",
"already",
"exist",
".",
"If",
"it",
"does",
"already",
"exist",
"this",
"does",
"nothing",
".",
"In",
"particular",
"the",
"existing",
"znode",
"may",
"have",
"a",
"different",
"payload",
"or",
"create",
"mode... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/curator/CuratorUtils.java#L48-L69 |
127,537 | apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java | RealtimePlumber.abandonSegment | protected void abandonSegment(final long truncatedTime, final Sink sink)
{
if (sinks.containsKey(truncatedTime)) {
try {
segmentAnnouncer.unannounceSegment(sink.getSegment());
removeSegment(sink, computePersistDir(schema, sink.getInterval()));
log.info("Removing sinkKey %d for segmen... | java | protected void abandonSegment(final long truncatedTime, final Sink sink)
{
if (sinks.containsKey(truncatedTime)) {
try {
segmentAnnouncer.unannounceSegment(sink.getSegment());
removeSegment(sink, computePersistDir(schema, sink.getInterval()));
log.info("Removing sinkKey %d for segmen... | [
"protected",
"void",
"abandonSegment",
"(",
"final",
"long",
"truncatedTime",
",",
"final",
"Sink",
"sink",
")",
"{",
"if",
"(",
"sinks",
".",
"containsKey",
"(",
"truncatedTime",
")",
")",
"{",
"try",
"{",
"segmentAnnouncer",
".",
"unannounceSegment",
"(",
... | Unannounces a given sink and removes all local references to it. It is important that this is only called
from the single-threaded mergeExecutor, since otherwise chaos may ensue if merged segments are deleted while
being created.
@param truncatedTime sink key
@param sink sink to unannounce | [
"Unannounces",
"a",
"given",
"sink",
"and",
"removes",
"all",
"local",
"references",
"to",
"it",
".",
"It",
"is",
"important",
"that",
"this",
"is",
"only",
"called",
"from",
"the",
"single",
"-",
"threaded",
"mergeExecutor",
"since",
"otherwise",
"chaos",
"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java#L872-L900 |
127,538 | apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java | RealtimePlumber.persistHydrant | protected int persistHydrant(
FireHydrant indexToPersist,
DataSchema schema,
Interval interval,
Map<String, Object> metadataElems
)
{
synchronized (indexToPersist) {
if (indexToPersist.hasSwapped()) {
log.info(
"DataSource[%s], Interval[%s], Hydrant[%s] already ... | java | protected int persistHydrant(
FireHydrant indexToPersist,
DataSchema schema,
Interval interval,
Map<String, Object> metadataElems
)
{
synchronized (indexToPersist) {
if (indexToPersist.hasSwapped()) {
log.info(
"DataSource[%s], Interval[%s], Hydrant[%s] already ... | [
"protected",
"int",
"persistHydrant",
"(",
"FireHydrant",
"indexToPersist",
",",
"DataSchema",
"schema",
",",
"Interval",
"interval",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"metadataElems",
")",
"{",
"synchronized",
"(",
"indexToPersist",
")",
"{",
"if",... | Persists the given hydrant and returns the number of rows persisted
@param indexToPersist hydrant to persist
@param schema datasource schema
@param interval interval to persist
@return the number of rows persisted | [
"Persists",
"the",
"given",
"hydrant",
"and",
"returns",
"the",
"number",
"of",
"rows",
"persisted"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java#L932-L983 |
127,539 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordinator/rules/LoadRule.java | LoadRule.assignPrimary | @Nullable
private ServerHolder assignPrimary(
final DruidCoordinatorRuntimeParams params,
final DataSegment segment
)
{
ServerHolder topCandidate = null;
for (final Object2IntMap.Entry<String> entry : targetReplicants.object2IntEntrySet()) {
final int targetReplicantsInTier = entry.getIn... | java | @Nullable
private ServerHolder assignPrimary(
final DruidCoordinatorRuntimeParams params,
final DataSegment segment
)
{
ServerHolder topCandidate = null;
for (final Object2IntMap.Entry<String> entry : targetReplicants.object2IntEntrySet()) {
final int targetReplicantsInTier = entry.getIn... | [
"@",
"Nullable",
"private",
"ServerHolder",
"assignPrimary",
"(",
"final",
"DruidCoordinatorRuntimeParams",
"params",
",",
"final",
"DataSegment",
"segment",
")",
"{",
"ServerHolder",
"topCandidate",
"=",
"null",
";",
"for",
"(",
"final",
"Object2IntMap",
".",
"Entr... | Iterates through each tier and find the respective segment homes; with the found segment homes, selects the one
with the highest priority to be the holder for the primary replica. | [
"Iterates",
"through",
"each",
"tier",
"and",
"find",
"the",
"respective",
"segment",
"homes",
";",
"with",
"the",
"found",
"segment",
"homes",
"selects",
"the",
"one",
"with",
"the",
"highest",
"priority",
"to",
"be",
"the",
"holder",
"for",
"the",
"primary... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/rules/LoadRule.java#L161-L220 |
127,540 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordinator/rules/LoadRule.java | LoadRule.loadingInProgress | private boolean loadingInProgress(final DruidCluster druidCluster)
{
for (final Object2IntMap.Entry<String> entry : targetReplicants.object2IntEntrySet()) {
final String tier = entry.getKey();
// if there are replicants loading in cluster
if (druidCluster.hasTier(tier) && entry.getIntValue() > c... | java | private boolean loadingInProgress(final DruidCluster druidCluster)
{
for (final Object2IntMap.Entry<String> entry : targetReplicants.object2IntEntrySet()) {
final String tier = entry.getKey();
// if there are replicants loading in cluster
if (druidCluster.hasTier(tier) && entry.getIntValue() > c... | [
"private",
"boolean",
"loadingInProgress",
"(",
"final",
"DruidCluster",
"druidCluster",
")",
"{",
"for",
"(",
"final",
"Object2IntMap",
".",
"Entry",
"<",
"String",
">",
"entry",
":",
"targetReplicants",
".",
"object2IntEntrySet",
"(",
")",
")",
"{",
"final",
... | Returns true if at least one tier in target replica assignment exists in cluster but does not have enough replicas. | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"tier",
"in",
"target",
"replica",
"assignment",
"exists",
"in",
"cluster",
"but",
"does",
"not",
"have",
"enough",
"replicas",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/rules/LoadRule.java#L362-L373 |
127,541 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java | StreamingMergeSortedGrouper.keyEquals | private boolean keyEquals(ByteBuffer curKeyBuffer, ByteBuffer buffer, int bufferOffset)
{
// Since this method is frequently called per each input row, the compare performance matters.
int i = 0;
for (; i + Long.BYTES <= keySize; i += Long.BYTES) {
if (curKeyBuffer.getLong(i) != buffer.getLong(buffe... | java | private boolean keyEquals(ByteBuffer curKeyBuffer, ByteBuffer buffer, int bufferOffset)
{
// Since this method is frequently called per each input row, the compare performance matters.
int i = 0;
for (; i + Long.BYTES <= keySize; i += Long.BYTES) {
if (curKeyBuffer.getLong(i) != buffer.getLong(buffe... | [
"private",
"boolean",
"keyEquals",
"(",
"ByteBuffer",
"curKeyBuffer",
",",
"ByteBuffer",
"buffer",
",",
"int",
"bufferOffset",
")",
"{",
"// Since this method is frequently called per each input row, the compare performance matters.",
"int",
"i",
"=",
"0",
";",
"for",
"(",
... | Checks two keys contained in the given buffers are same.
@param curKeyBuffer the buffer for the given key from {@link #aggregate(Object)}
@param buffer the whole array buffer
@param bufferOffset the key offset of the buffer
@return true if the two buffers are same. | [
"Checks",
"two",
"keys",
"contained",
"in",
"the",
"given",
"buffers",
"are",
"same",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java#L234-L259 |
127,542 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java | StreamingMergeSortedGrouper.initNewSlot | private void initNewSlot(ByteBuffer newKey)
{
// Wait if the array is full and increase curWriteIndex
increaseWriteIndex();
final int recordOffset = recordSize * curWriteIndex;
buffer.position(recordOffset);
buffer.put(newKey);
for (int i = 0; i < aggregators.length; i++) {
aggregators... | java | private void initNewSlot(ByteBuffer newKey)
{
// Wait if the array is full and increase curWriteIndex
increaseWriteIndex();
final int recordOffset = recordSize * curWriteIndex;
buffer.position(recordOffset);
buffer.put(newKey);
for (int i = 0; i < aggregators.length; i++) {
aggregators... | [
"private",
"void",
"initNewSlot",
"(",
"ByteBuffer",
"newKey",
")",
"{",
"// Wait if the array is full and increase curWriteIndex",
"increaseWriteIndex",
"(",
")",
";",
"final",
"int",
"recordOffset",
"=",
"recordSize",
"*",
"curWriteIndex",
";",
"buffer",
".",
"positio... | Initialize a new slot for a new grouping key. This may be potentially blocked if the array is full until at least
one slot becomes available. | [
"Initialize",
"a",
"new",
"slot",
"for",
"a",
"new",
"grouping",
"key",
".",
"This",
"may",
"be",
"potentially",
"blocked",
"if",
"the",
"array",
"is",
"full",
"until",
"at",
"least",
"one",
"slot",
"becomes",
"available",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java#L265-L277 |
127,543 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java | StreamingMergeSortedGrouper.iterator | public CloseableIterator<Entry<KeyType>> iterator()
{
if (!initialized) {
throw new ISE("Grouper should be initialized first");
}
return new CloseableIterator<Entry<KeyType>>()
{
{
// Wait for some data to be ready and initialize nextReadIndex.
increaseReadIndexTo(0);
... | java | public CloseableIterator<Entry<KeyType>> iterator()
{
if (!initialized) {
throw new ISE("Grouper should be initialized first");
}
return new CloseableIterator<Entry<KeyType>>()
{
{
// Wait for some data to be ready and initialize nextReadIndex.
increaseReadIndexTo(0);
... | [
"public",
"CloseableIterator",
"<",
"Entry",
"<",
"KeyType",
">",
">",
"iterator",
"(",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"Grouper should be initialized first\"",
")",
";",
"}",
"return",
"new",
"CloseableIterator... | Return a sorted iterator. This method can be called safely while writing, and the iterating thread and the writing
thread can be different. The result iterator always returns sorted results. This method should be called only one
time per grouper.
@return a sorted iterator | [
"Return",
"a",
"sorted",
"iterator",
".",
"This",
"method",
"can",
"be",
"called",
"safely",
"while",
"writing",
"and",
"the",
"iterating",
"thread",
"and",
"the",
"writing",
"thread",
"can",
"be",
"different",
".",
"The",
"result",
"iterator",
"always",
"re... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java#L379-L494 |
127,544 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/transform/Transformer.java | Transformer.transform | @Nullable
public InputRow transform(@Nullable final InputRow row)
{
if (row == null) {
return null;
}
final InputRow transformedRow;
if (transforms.isEmpty()) {
transformedRow = row;
} else {
transformedRow = new TransformedInputRow(row, transforms);
}
if (valueMatch... | java | @Nullable
public InputRow transform(@Nullable final InputRow row)
{
if (row == null) {
return null;
}
final InputRow transformedRow;
if (transforms.isEmpty()) {
transformedRow = row;
} else {
transformedRow = new TransformedInputRow(row, transforms);
}
if (valueMatch... | [
"@",
"Nullable",
"public",
"InputRow",
"transform",
"(",
"@",
"Nullable",
"final",
"InputRow",
"row",
")",
"{",
"if",
"(",
"row",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"InputRow",
"transformedRow",
";",
"if",
"(",
"transforms",
"."... | Transforms an input row, or returns null if the row should be filtered out.
@param row the input row | [
"Transforms",
"an",
"input",
"row",
"or",
"returns",
"null",
"if",
"the",
"row",
"should",
"be",
"filtered",
"out",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/transform/Transformer.java#L71-L94 |
127,545 | apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java | StreamAppenderatorDriver.publish | public ListenableFuture<SegmentsAndMetadata> publish(
final TransactionalSegmentPublisher publisher,
final Committer committer,
final Collection<String> sequenceNames
)
{
final List<SegmentIdWithShardSpec> theSegments = getSegmentWithStates(sequenceNames)
.map(SegmentWithState::getSegm... | java | public ListenableFuture<SegmentsAndMetadata> publish(
final TransactionalSegmentPublisher publisher,
final Committer committer,
final Collection<String> sequenceNames
)
{
final List<SegmentIdWithShardSpec> theSegments = getSegmentWithStates(sequenceNames)
.map(SegmentWithState::getSegm... | [
"public",
"ListenableFuture",
"<",
"SegmentsAndMetadata",
">",
"publish",
"(",
"final",
"TransactionalSegmentPublisher",
"publisher",
",",
"final",
"Committer",
"committer",
",",
"final",
"Collection",
"<",
"String",
">",
"sequenceNames",
")",
"{",
"final",
"List",
... | Execute a task in background to publish all segments corresponding to the given sequence names. The task
internally pushes the segments to the deep storage first, and then publishes the metadata to the metadata storage.
@param publisher segment publisher
@param committer committer
@param sequenceNames a colle... | [
"Execute",
"a",
"task",
"in",
"background",
"to",
"publish",
"all",
"segments",
"corresponding",
"to",
"the",
"given",
"sequence",
"names",
".",
"The",
"task",
"internally",
"pushes",
"the",
"segments",
"to",
"the",
"deep",
"storage",
"first",
"and",
"then",
... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java#L261-L289 |
127,546 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/GroupByQueryQueryToolChest.java | GroupByQueryQueryToolChest.extractionsToRewrite | public static Collection<DimensionSpec> extractionsToRewrite(GroupByQuery query)
{
return Collections2.filter(
query.getDimensions(), new Predicate<DimensionSpec>()
{
@Override
public boolean apply(DimensionSpec input)
{
return input.getExtractionFn() != n... | java | public static Collection<DimensionSpec> extractionsToRewrite(GroupByQuery query)
{
return Collections2.filter(
query.getDimensions(), new Predicate<DimensionSpec>()
{
@Override
public boolean apply(DimensionSpec input)
{
return input.getExtractionFn() != n... | [
"public",
"static",
"Collection",
"<",
"DimensionSpec",
">",
"extractionsToRewrite",
"(",
"GroupByQuery",
"query",
")",
"{",
"return",
"Collections2",
".",
"filter",
"(",
"query",
".",
"getDimensions",
"(",
")",
",",
"new",
"Predicate",
"<",
"DimensionSpec",
">"... | This function checks the query for dimensions which can be optimized by applying the dimension extraction
as the final step of the query instead of on every event.
@param query The query to check for optimizations
@return A collection of DimensionsSpec which can be extracted at the last second upon query completion. | [
"This",
"function",
"checks",
"the",
"query",
"for",
"dimensions",
"which",
"can",
"be",
"optimized",
"by",
"applying",
"the",
"dimension",
"extraction",
"as",
"the",
"final",
"step",
"of",
"the",
"query",
"instead",
"of",
"on",
"every",
"event",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/GroupByQueryQueryToolChest.java#L609-L624 |
127,547 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java | DimensionHandlerUtils.createColumnSelectorPluses | public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy>
//CHECKSTYLE.OFF: Indentation
ColumnSelectorPlus<ColumnSelectorStrategyClass>[] createColumnSelectorPluses(
//CHECKSTYLE.ON: Indentation
ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory,
List<Dimen... | java | public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy>
//CHECKSTYLE.OFF: Indentation
ColumnSelectorPlus<ColumnSelectorStrategyClass>[] createColumnSelectorPluses(
//CHECKSTYLE.ON: Indentation
ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory,
List<Dimen... | [
"public",
"static",
"<",
"ColumnSelectorStrategyClass",
"extends",
"ColumnSelectorStrategy",
">",
"//CHECKSTYLE.OFF: Indentation",
"ColumnSelectorPlus",
"<",
"ColumnSelectorStrategyClass",
">",
"[",
"]",
"createColumnSelectorPluses",
"(",
"//CHECKSTYLE.ON: Indentation",
"ColumnSele... | Creates an array of ColumnSelectorPlus objects, selectors that handle type-specific operations within
query processing engines, using a strategy factory provided by the query engine. One ColumnSelectorPlus
will be created for each column specified in dimensionSpecs.
The ColumnSelectorPlus provides access to a type str... | [
"Creates",
"an",
"array",
"of",
"ColumnSelectorPlus",
"objects",
"selectors",
"that",
"handle",
"type",
"-",
"specific",
"operations",
"within",
"query",
"processing",
"engines",
"using",
"a",
"strategy",
"factory",
"provided",
"by",
"the",
"query",
"engine",
".",... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java#L144-L178 |
127,548 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java | DimensionHandlerUtils.getExactLongFromDecimalString | @Nullable
public static Long getExactLongFromDecimalString(String decimalStr)
{
final Long val = GuavaUtils.tryParseLong(decimalStr);
if (val != null) {
return val;
}
BigDecimal convertedBD;
try {
convertedBD = new BigDecimal(decimalStr);
}
catch (NumberFormatException nfe) ... | java | @Nullable
public static Long getExactLongFromDecimalString(String decimalStr)
{
final Long val = GuavaUtils.tryParseLong(decimalStr);
if (val != null) {
return val;
}
BigDecimal convertedBD;
try {
convertedBD = new BigDecimal(decimalStr);
}
catch (NumberFormatException nfe) ... | [
"@",
"Nullable",
"public",
"static",
"Long",
"getExactLongFromDecimalString",
"(",
"String",
"decimalStr",
")",
"{",
"final",
"Long",
"val",
"=",
"GuavaUtils",
".",
"tryParseLong",
"(",
"decimalStr",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"retur... | Convert a string representing a decimal value to a long.
If the decimal value is not an exact integral value (e.g. 42.0), or if the decimal value
is too large to be contained within a long, this function returns null.
@param decimalStr string representing a decimal value
@return long equivalent of decimalStr, return... | [
"Convert",
"a",
"string",
"representing",
"a",
"decimal",
"value",
"to",
"a",
"long",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java#L402-L425 |
127,549 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java | RowBasedGrouperHelper.createGrouperAccumulatorPair | public static Pair<Grouper<RowBasedKey>, Accumulator<AggregateResult, Row>> createGrouperAccumulatorPair(
final GroupByQuery query,
final boolean isInputRaw,
final Map<String, ValueType> rawInputRowSignature,
final GroupByQueryConfig config,
final Supplier<ByteBuffer> bufferSupplier,
... | java | public static Pair<Grouper<RowBasedKey>, Accumulator<AggregateResult, Row>> createGrouperAccumulatorPair(
final GroupByQuery query,
final boolean isInputRaw,
final Map<String, ValueType> rawInputRowSignature,
final GroupByQueryConfig config,
final Supplier<ByteBuffer> bufferSupplier,
... | [
"public",
"static",
"Pair",
"<",
"Grouper",
"<",
"RowBasedKey",
">",
",",
"Accumulator",
"<",
"AggregateResult",
",",
"Row",
">",
">",
"createGrouperAccumulatorPair",
"(",
"final",
"GroupByQuery",
"query",
",",
"final",
"boolean",
"isInputRaw",
",",
"final",
"Ma... | Create a single-threaded grouper and accumulator. | [
"Create",
"a",
"single",
"-",
"threaded",
"grouper",
"and",
"accumulator",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java#L99-L128 |
127,550 | apache/incubator-druid | core/src/main/java/org/apache/druid/math/expr/Evals.java | Evals.binaryOp | public static Expr binaryOp(BinaryOpExprBase binary, Expr left, Expr right)
{
try {
return binary.getClass()
.getDeclaredConstructor(String.class, Expr.class, Expr.class)
.newInstance(binary.op, left, right);
}
catch (Exception e) {
log.warn(e, "failed to ... | java | public static Expr binaryOp(BinaryOpExprBase binary, Expr left, Expr right)
{
try {
return binary.getClass()
.getDeclaredConstructor(String.class, Expr.class, Expr.class)
.newInstance(binary.op, left, right);
}
catch (Exception e) {
log.warn(e, "failed to ... | [
"public",
"static",
"Expr",
"binaryOp",
"(",
"BinaryOpExprBase",
"binary",
",",
"Expr",
"left",
",",
"Expr",
"right",
")",
"{",
"try",
"{",
"return",
"binary",
".",
"getClass",
"(",
")",
".",
"getDeclaredConstructor",
"(",
"String",
".",
"class",
",",
"Exp... | you should create it explicitly in here | [
"you",
"should",
"create",
"it",
"explicitly",
"in",
"here"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/math/expr/Evals.java#L51-L62 |
127,551 | apache/incubator-druid | indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/MetadataStorageUpdaterJobSpec.java | MetadataStorageUpdaterJobSpec.getMetadataStorageTablesConfig | public MetadataStorageTablesConfig getMetadataStorageTablesConfig()
{
return new MetadataStorageTablesConfig(
null,
null,
null,
segmentTable,
null,
null,
null,
null,
null,
null,
null
);
} | java | public MetadataStorageTablesConfig getMetadataStorageTablesConfig()
{
return new MetadataStorageTablesConfig(
null,
null,
null,
segmentTable,
null,
null,
null,
null,
null,
null,
null
);
} | [
"public",
"MetadataStorageTablesConfig",
"getMetadataStorageTablesConfig",
"(",
")",
"{",
"return",
"new",
"MetadataStorageTablesConfig",
"(",
"null",
",",
"null",
",",
"null",
",",
"segmentTable",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
... | by the code using this | [
"by",
"the",
"code",
"using",
"this"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/MetadataStorageUpdaterJobSpec.java#L87-L102 |
127,552 | apache/incubator-druid | core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java | ConcurrentAwaitableCounter.awaitNextIncrements | public void awaitNextIncrements(long nextIncrements) throws InterruptedException
{
if (nextIncrements <= 0) {
throw new IllegalArgumentException("nextIncrements is not positive: " + nextIncrements);
}
if (nextIncrements > MAX_COUNT / 4) {
throw new UnsupportedOperationException("Couldn't wait ... | java | public void awaitNextIncrements(long nextIncrements) throws InterruptedException
{
if (nextIncrements <= 0) {
throw new IllegalArgumentException("nextIncrements is not positive: " + nextIncrements);
}
if (nextIncrements > MAX_COUNT / 4) {
throw new UnsupportedOperationException("Couldn't wait ... | [
"public",
"void",
"awaitNextIncrements",
"(",
"long",
"nextIncrements",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"nextIncrements",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"nextIncrements is not positive: \"",
"+",
"nextIncre... | Somewhat loosely defined wait for "next N increments", because the starting point is not defined from the Java
Memory Model perspective. | [
"Somewhat",
"loosely",
"defined",
"wait",
"for",
"next",
"N",
"increments",
"because",
"the",
"starting",
"point",
"is",
"not",
"defined",
"from",
"the",
"Java",
"Memory",
"Model",
"perspective",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java#L145-L154 |
127,553 | apache/incubator-druid | services/src/main/java/org/apache/druid/cli/PullDependencies.java | PullDependencies.downloadExtension | private void downloadExtension(Artifact versionedArtifact, File toLocation)
{
final CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(versionedArtifact, JavaScopes.RUNTIME));
final DependencyRequest dependencyRequest = new DependencyRequest(
collectRequest... | java | private void downloadExtension(Artifact versionedArtifact, File toLocation)
{
final CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(versionedArtifact, JavaScopes.RUNTIME));
final DependencyRequest dependencyRequest = new DependencyRequest(
collectRequest... | [
"private",
"void",
"downloadExtension",
"(",
"Artifact",
"versionedArtifact",
",",
"File",
"toLocation",
")",
"{",
"final",
"CollectRequest",
"collectRequest",
"=",
"new",
"CollectRequest",
"(",
")",
";",
"collectRequest",
".",
"setRoot",
"(",
"new",
"Dependency",
... | Download the extension given its maven coordinate
@param versionedArtifact The maven artifact of the extension
@param toLocation The location where this extension will be downloaded to | [
"Download",
"the",
"extension",
"given",
"its",
"maven",
"coordinate"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/services/src/main/java/org/apache/druid/cli/PullDependencies.java#L351-L416 |
127,554 | apache/incubator-druid | services/src/main/java/org/apache/druid/cli/PullDependencies.java | PullDependencies.createExtensionDirectory | private void createExtensionDirectory(String coordinate, File atLocation)
{
if (atLocation.isDirectory()) {
log.info("Directory [%s] already exists, skipping creating a directory", atLocation.getAbsolutePath());
return;
}
if (!atLocation.mkdir()) {
throw new ISE(
"Unable to cr... | java | private void createExtensionDirectory(String coordinate, File atLocation)
{
if (atLocation.isDirectory()) {
log.info("Directory [%s] already exists, skipping creating a directory", atLocation.getAbsolutePath());
return;
}
if (!atLocation.mkdir()) {
throw new ISE(
"Unable to cr... | [
"private",
"void",
"createExtensionDirectory",
"(",
"String",
"coordinate",
",",
"File",
"atLocation",
")",
"{",
"if",
"(",
"atLocation",
".",
"isDirectory",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Directory [%s] already exists, skipping creating a directory\"... | Create the extension directory for a specific maven coordinate.
The name of this directory should be the artifactId in the coordinate | [
"Create",
"the",
"extension",
"directory",
"for",
"a",
"specific",
"maven",
"coordinate",
".",
"The",
"name",
"of",
"this",
"directory",
"should",
"be",
"the",
"artifactId",
"in",
"the",
"coordinate"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/services/src/main/java/org/apache/druid/cli/PullDependencies.java#L545-L559 |
127,555 | apache/incubator-druid | extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildBufferAggregator.java | HllSketchBuildBufferAggregator.relocate | @Override
public void relocate(final int oldPosition, final int newPosition, final ByteBuffer oldBuf, final ByteBuffer newBuf)
{
HllSketch sketch = sketchCache.get(oldBuf).get(oldPosition);
final WritableMemory oldMem = getMemory(oldBuf).writableRegion(oldPosition, size);
if (sketch.isSameResource(oldMe... | java | @Override
public void relocate(final int oldPosition, final int newPosition, final ByteBuffer oldBuf, final ByteBuffer newBuf)
{
HllSketch sketch = sketchCache.get(oldBuf).get(oldPosition);
final WritableMemory oldMem = getMemory(oldBuf).writableRegion(oldPosition, size);
if (sketch.isSameResource(oldMe... | [
"@",
"Override",
"public",
"void",
"relocate",
"(",
"final",
"int",
"oldPosition",
",",
"final",
"int",
"newPosition",
",",
"final",
"ByteBuffer",
"oldBuf",
",",
"final",
"ByteBuffer",
"newBuf",
")",
"{",
"HllSketch",
"sketch",
"=",
"sketchCache",
".",
"get",
... | In very rare cases sketches can exceed given memory, request on-heap memory and move there.
We need to identify such sketches and reuse the same objects as opposed to wrapping new memory regions. | [
"In",
"very",
"rare",
"cases",
"sketches",
"can",
"exceed",
"given",
"memory",
"request",
"on",
"-",
"heap",
"memory",
"and",
"move",
"there",
".",
"We",
"need",
"to",
"identify",
"such",
"sketches",
"and",
"reuse",
"the",
"same",
"objects",
"as",
"opposed... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildBufferAggregator.java#L146-L156 |
127,556 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java | FileSmoosher.mergeWithSmoosher | private void mergeWithSmoosher() throws IOException
{
// Get processed elements from the stack and write.
List<File> fileToProcess = new ArrayList<>(completedFiles);
completedFiles = new ArrayList<>();
for (File file : fileToProcess) {
add(file);
if (!file.delete()) {
LOG.warn("Una... | java | private void mergeWithSmoosher() throws IOException
{
// Get processed elements from the stack and write.
List<File> fileToProcess = new ArrayList<>(completedFiles);
completedFiles = new ArrayList<>();
for (File file : fileToProcess) {
add(file);
if (!file.delete()) {
LOG.warn("Una... | [
"private",
"void",
"mergeWithSmoosher",
"(",
")",
"throws",
"IOException",
"{",
"// Get processed elements from the stack and write.",
"List",
"<",
"File",
">",
"fileToProcess",
"=",
"new",
"ArrayList",
"<>",
"(",
"completedFiles",
")",
";",
"completedFiles",
"=",
"ne... | Merges temporary files created by delegated SmooshedWriters on to the main
smoosh file.
@throws IOException | [
"Merges",
"temporary",
"files",
"created",
"by",
"delegated",
"SmooshedWriters",
"on",
"to",
"the",
"main",
"smoosh",
"file",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java#L248-L259 |
127,557 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/schema/InformationSchema.java | InformationSchema.getView | @Nullable
private static TableMacro getView(final SchemaPlus schemaPlus, final String functionName)
{
// Look for a zero-arg function that is also a TableMacro. The returned value
// is never null so we don't need to check for that.
final Collection<org.apache.calcite.schema.Function> functions =
... | java | @Nullable
private static TableMacro getView(final SchemaPlus schemaPlus, final String functionName)
{
// Look for a zero-arg function that is also a TableMacro. The returned value
// is never null so we don't need to check for that.
final Collection<org.apache.calcite.schema.Function> functions =
... | [
"@",
"Nullable",
"private",
"static",
"TableMacro",
"getView",
"(",
"final",
"SchemaPlus",
"schemaPlus",
",",
"final",
"String",
"functionName",
")",
"{",
"// Look for a zero-arg function that is also a TableMacro. The returned value",
"// is never null so we don't need to check fo... | Return a view macro that may or may not be defined in a certain schema. If it's not defined, returns null.
@param schemaPlus schema
@param functionName function name
@return view, or null | [
"Return",
"a",
"view",
"macro",
"that",
"may",
"or",
"may",
"not",
"be",
"defined",
"in",
"a",
"certain",
"schema",
".",
"If",
"it",
"s",
"not",
"defined",
"returns",
"null",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/schema/InformationSchema.java#L432-L447 |
127,558 | apache/incubator-druid | extensions-contrib/druid-rocketmq/src/main/java/org/apache/druid/firehose/rocketmq/RocketMQFirehoseFactory.java | RocketMQFirehoseFactory.hasMessagesPending | private boolean hasMessagesPending()
{
for (Map.Entry<MessageQueue, ConcurrentSkipListSet<MessageExt>> entry : messageQueueTreeSetMap.entrySet()) {
if (!entry.getValue().isEmpty()) {
return true;
}
}
return false;
} | java | private boolean hasMessagesPending()
{
for (Map.Entry<MessageQueue, ConcurrentSkipListSet<MessageExt>> entry : messageQueueTreeSetMap.entrySet()) {
if (!entry.getValue().isEmpty()) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"hasMessagesPending",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"MessageQueue",
",",
"ConcurrentSkipListSet",
"<",
"MessageExt",
">",
">",
"entry",
":",
"messageQueueTreeSetMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"("... | Check if there are locally pending messages to consume.
@return true if there are some; false otherwise. | [
"Check",
"if",
"there",
"are",
"locally",
"pending",
"messages",
"to",
"consume",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-contrib/druid-rocketmq/src/main/java/org/apache/druid/firehose/rocketmq/RocketMQFirehoseFactory.java#L131-L141 |
127,559 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.zip | public static long zip(File directory, OutputStream out) throws IOException
{
if (!directory.isDirectory()) {
throw new IOE("directory[%s] is not a directory", directory);
}
final ZipOutputStream zipOut = new ZipOutputStream(out);
long totalSize = 0;
for (File file : directory.listFiles())... | java | public static long zip(File directory, OutputStream out) throws IOException
{
if (!directory.isDirectory()) {
throw new IOE("directory[%s] is not a directory", directory);
}
final ZipOutputStream zipOut = new ZipOutputStream(out);
long totalSize = 0;
for (File file : directory.listFiles())... | [
"public",
"static",
"long",
"zip",
"(",
"File",
"directory",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IOE",
"(",
"\"directory[%s] is not a directory\"",... | Zips the contents of the input directory to the output stream. Sub directories are skipped
@param directory The directory whose contents should be added to the zip in the output stream.
@param out The output stream to write the zip data to. Caller is responsible for closing this stream.
@return The number of by... | [
"Zips",
"the",
"contents",
"of",
"the",
"input",
"directory",
"to",
"the",
"output",
"stream",
".",
"Sub",
"directories",
"are",
"skipped"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L132-L156 |
127,560 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.unzip | public static FileUtils.FileCopyResult unzip(
final ByteSource byteSource,
final File outDir,
boolean cacheLocally
) throws IOException
{
return unzip(byteSource, outDir, FileUtils.IS_EXCEPTION, cacheLocally);
} | java | public static FileUtils.FileCopyResult unzip(
final ByteSource byteSource,
final File outDir,
boolean cacheLocally
) throws IOException
{
return unzip(byteSource, outDir, FileUtils.IS_EXCEPTION, cacheLocally);
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"unzip",
"(",
"final",
"ByteSource",
"byteSource",
",",
"final",
"File",
"outDir",
",",
"boolean",
"cacheLocally",
")",
"throws",
"IOException",
"{",
"return",
"unzip",
"(",
"byteSource",
",",
"outDir",
","... | Unzip the byteSource to the output directory. If cacheLocally is true, the byteSource is cached to local disk before unzipping.
This may cause more predictable behavior than trying to unzip a large file directly off a network stream, for example.
@param byteSource The ByteSource which supplies the zip data
@param ou... | [
"Unzip",
"the",
"byteSource",
"to",
"the",
"output",
"directory",
".",
"If",
"cacheLocally",
"is",
"true",
"the",
"byteSource",
"is",
"cached",
"to",
"local",
"disk",
"before",
"unzipping",
".",
"This",
"may",
"cause",
"more",
"predictable",
"behavior",
"than"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L224-L231 |
127,561 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gunzip | public static FileUtils.FileCopyResult gunzip(final File pulledFile, File outFile)
{
return gunzip(Files.asByteSource(pulledFile), outFile);
} | java | public static FileUtils.FileCopyResult gunzip(final File pulledFile, File outFile)
{
return gunzip(Files.asByteSource(pulledFile), outFile);
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"gunzip",
"(",
"final",
"File",
"pulledFile",
",",
"File",
"outFile",
")",
"{",
"return",
"gunzip",
"(",
"Files",
".",
"asByteSource",
"(",
"pulledFile",
")",
",",
"outFile",
")",
";",
"}"
] | gunzip the file to the output file.
@param pulledFile The source of the gz data
@param outFile A target file to put the contents
@return The result of the file copy
@throws IOException | [
"gunzip",
"the",
"file",
"to",
"the",
"output",
"file",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L338-L341 |
127,562 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gunzip | public static long gunzip(InputStream in, OutputStream out) throws IOException
{
try (GZIPInputStream gzipInputStream = gzipInputStream(in)) {
final long result = ByteStreams.copy(gzipInputStream, out);
out.flush();
return result;
}
finally {
out.close();
}
} | java | public static long gunzip(InputStream in, OutputStream out) throws IOException
{
try (GZIPInputStream gzipInputStream = gzipInputStream(in)) {
final long result = ByteStreams.copy(gzipInputStream, out);
out.flush();
return result;
}
finally {
out.close();
}
} | [
"public",
"static",
"long",
"gunzip",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"try",
"(",
"GZIPInputStream",
"gzipInputStream",
"=",
"gzipInputStream",
"(",
"in",
")",
")",
"{",
"final",
"long",
"result",
"=",
... | gunzip from the source stream to the destination stream.
@param in The input stream which is to be decompressed. This stream is closed.
@param out The output stream to write to. This stream is closed
@return The number of bytes written to the output stream.
@throws IOException | [
"gunzip",
"from",
"the",
"source",
"stream",
"to",
"the",
"destination",
"stream",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L395-L405 |
127,563 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gunzip | public static FileUtils.FileCopyResult gunzip(
final ByteSource in,
final File outFile,
Predicate<Throwable> shouldRetry
)
{
return FileUtils.retryCopy(
new ByteSource()
{
@Override
public InputStream openStream() throws IOException
{
r... | java | public static FileUtils.FileCopyResult gunzip(
final ByteSource in,
final File outFile,
Predicate<Throwable> shouldRetry
)
{
return FileUtils.retryCopy(
new ByteSource()
{
@Override
public InputStream openStream() throws IOException
{
r... | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"gunzip",
"(",
"final",
"ByteSource",
"in",
",",
"final",
"File",
"outFile",
",",
"Predicate",
"<",
"Throwable",
">",
"shouldRetry",
")",
"{",
"return",
"FileUtils",
".",
"retryCopy",
"(",
"new",
"ByteSou... | A gunzip function to store locally
@param in The factory to produce input streams
@param outFile The file to store the result into
@param shouldRetry A predicate to indicate if the Throwable is recoverable
@return The count of bytes written to outFile | [
"A",
"gunzip",
"function",
"to",
"store",
"locally"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L416-L435 |
127,564 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gunzip | public static FileUtils.FileCopyResult gunzip(final ByteSource in, File outFile)
{
return gunzip(in, outFile, FileUtils.IS_EXCEPTION);
} | java | public static FileUtils.FileCopyResult gunzip(final ByteSource in, File outFile)
{
return gunzip(in, outFile, FileUtils.IS_EXCEPTION);
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"gunzip",
"(",
"final",
"ByteSource",
"in",
",",
"File",
"outFile",
")",
"{",
"return",
"gunzip",
"(",
"in",
",",
"outFile",
",",
"FileUtils",
".",
"IS_EXCEPTION",
")",
";",
"}"
] | Gunzip from the input stream to the output file
@param in The compressed input stream to read from
@param outFile The file to write the uncompressed results to
@return A FileCopyResult of the file written | [
"Gunzip",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"file"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L446-L449 |
127,565 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gzip | public static long gzip(InputStream inputStream, OutputStream out) throws IOException
{
try (GZIPOutputStream outputStream = new GZIPOutputStream(out)) {
final long result = ByteStreams.copy(inputStream, outputStream);
out.flush();
return result;
}
finally {
inputStream.close();
... | java | public static long gzip(InputStream inputStream, OutputStream out) throws IOException
{
try (GZIPOutputStream outputStream = new GZIPOutputStream(out)) {
final long result = ByteStreams.copy(inputStream, outputStream);
out.flush();
return result;
}
finally {
inputStream.close();
... | [
"public",
"static",
"long",
"gzip",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"try",
"(",
"GZIPOutputStream",
"outputStream",
"=",
"new",
"GZIPOutputStream",
"(",
"out",
")",
")",
"{",
"final",
"long",
"r... | Copy inputStream to out while wrapping out in a GZIPOutputStream
Closes both input and output
@param inputStream The input stream to copy data from. This stream is closed
@param out The output stream to wrap in a GZIPOutputStream before copying. This stream is closed
@return The size of the data copied
@thro... | [
"Copy",
"inputStream",
"to",
"out",
"while",
"wrapping",
"out",
"in",
"a",
"GZIPOutputStream",
"Closes",
"both",
"input",
"and",
"output"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L462-L472 |
127,566 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gzip | public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile, Predicate<Throwable> shouldRetry)
{
gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry);
return new FileUtils.FileCopyResult(outFile);
} | java | public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile, Predicate<Throwable> shouldRetry)
{
gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry);
return new FileUtils.FileCopyResult(outFile);
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"gzip",
"(",
"final",
"File",
"inFile",
",",
"final",
"File",
"outFile",
",",
"Predicate",
"<",
"Throwable",
">",
"shouldRetry",
")",
"{",
"gzip",
"(",
"Files",
".",
"asByteSource",
"(",
"inFile",
")",
... | Gzips the input file to the output
@param inFile The file to gzip
@param outFile A target file to copy the uncompressed contents of inFile to
@param shouldRetry Predicate on a potential throwable to determine if the copy should be attempted again.
@return The result of the file copy
@throws IOException | [
"Gzips",
"the",
"input",
"file",
"to",
"the",
"output"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L485-L489 |
127,567 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.gzip | public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile)
{
return gzip(inFile, outFile, FileUtils.IS_EXCEPTION);
} | java | public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile)
{
return gzip(inFile, outFile, FileUtils.IS_EXCEPTION);
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"gzip",
"(",
"final",
"File",
"inFile",
",",
"final",
"File",
"outFile",
")",
"{",
"return",
"gzip",
"(",
"inFile",
",",
"outFile",
",",
"FileUtils",
".",
"IS_EXCEPTION",
")",
";",
"}"
] | GZip compress the contents of inFile into outFile
@param inFile The source of data
@param outFile The destination for compressed data
@return A FileCopyResult of the resulting file at outFile
@throws IOException | [
"GZip",
"compress",
"the",
"contents",
"of",
"inFile",
"into",
"outFile"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L519-L522 |
127,568 | apache/incubator-druid | core/src/main/java/org/apache/druid/utils/CompressionUtils.java | CompressionUtils.decompress | public static InputStream decompress(final InputStream in, final String fileName) throws IOException
{
if (fileName.endsWith(GZ_SUFFIX)) {
return gzipInputStream(in);
} else if (fileName.endsWith(BZ2_SUFFIX)) {
return new BZip2CompressorInputStream(in, true);
} else if (fileName.endsWith(XZ_SU... | java | public static InputStream decompress(final InputStream in, final String fileName) throws IOException
{
if (fileName.endsWith(GZ_SUFFIX)) {
return gzipInputStream(in);
} else if (fileName.endsWith(BZ2_SUFFIX)) {
return new BZip2CompressorInputStream(in, true);
} else if (fileName.endsWith(XZ_SU... | [
"public",
"static",
"InputStream",
"decompress",
"(",
"final",
"InputStream",
"in",
",",
"final",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fileName",
".",
"endsWith",
"(",
"GZ_SUFFIX",
")",
")",
"{",
"return",
"gzipInputStream",
"("... | Decompress an input stream from a file, based on the filename. | [
"Decompress",
"an",
"input",
"stream",
"from",
"a",
"file",
"based",
"on",
"the",
"filename",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L575-L612 |
127,569 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/metrics/cgroups/CpuAcct.java | CpuAcct.parse | private static CpuAcctMetric parse(final List<String> lines)
{
// File has a header. We skip it
// See src/test/resources/cpuacct.usage_all for an example
final int ncpus = lines.size() - 1;
final long[] usrTime = new long[ncpus];
final long[] sysTime = new long[ncpus];
for (int i = 1; i < lin... | java | private static CpuAcctMetric parse(final List<String> lines)
{
// File has a header. We skip it
// See src/test/resources/cpuacct.usage_all for an example
final int ncpus = lines.size() - 1;
final long[] usrTime = new long[ncpus];
final long[] sysTime = new long[ncpus];
for (int i = 1; i < lin... | [
"private",
"static",
"CpuAcctMetric",
"parse",
"(",
"final",
"List",
"<",
"String",
">",
"lines",
")",
"{",
"// File has a header. We skip it",
"// See src/test/resources/cpuacct.usage_all for an example",
"final",
"int",
"ncpus",
"=",
"lines",
".",
"size",
"(",
")",
... | Private because it requires a specific format and cant' take a generic list of strings | [
"Private",
"because",
"it",
"requires",
"a",
"specific",
"format",
"and",
"cant",
"take",
"a",
"generic",
"list",
"of",
"strings"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/metrics/cgroups/CpuAcct.java#L41-L58 |
127,570 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/metrics/cgroups/CpuAcct.java | CpuAcct.snapshot | public CpuAcctMetric snapshot()
{
final File cpuacct;
try {
cpuacct = new File(
cgroupDiscoverer.discover(CGROUP).toFile(),
CGROUP_ACCT_FILE
);
}
catch (RuntimeException re) {
LOG.error(re, "Unable to fetch snapshot");
return new CpuAcctMetric(new long[0], n... | java | public CpuAcctMetric snapshot()
{
final File cpuacct;
try {
cpuacct = new File(
cgroupDiscoverer.discover(CGROUP).toFile(),
CGROUP_ACCT_FILE
);
}
catch (RuntimeException re) {
LOG.error(re, "Unable to fetch snapshot");
return new CpuAcctMetric(new long[0], n... | [
"public",
"CpuAcctMetric",
"snapshot",
"(",
")",
"{",
"final",
"File",
"cpuacct",
";",
"try",
"{",
"cpuacct",
"=",
"new",
"File",
"(",
"cgroupDiscoverer",
".",
"discover",
"(",
"CGROUP",
")",
".",
"toFile",
"(",
")",
",",
"CGROUP_ACCT_FILE",
")",
";",
"}... | Take a snapshot of the existing data.
@return A snapshot with the data populated or a snapshot with zero-length arrays for data. | [
"Take",
"a",
"snapshot",
"of",
"the",
"existing",
"data",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/metrics/cgroups/CpuAcct.java#L72-L91 |
127,571 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/http/CoordinatorResource.java | CoordinatorResource.isLeader | @GET
@Path("/isLeader")
@Produces(MediaType.APPLICATION_JSON)
public Response isLeader()
{
final boolean leading = coordinator.isLeader();
final Map<String, Boolean> response = ImmutableMap.of("leader", leading);
if (leading) {
return Response.ok(response).build();
} else {
return Re... | java | @GET
@Path("/isLeader")
@Produces(MediaType.APPLICATION_JSON)
public Response isLeader()
{
final boolean leading = coordinator.isLeader();
final Map<String, Boolean> response = ImmutableMap.of("leader", leading);
if (leading) {
return Response.ok(response).build();
} else {
return Re... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/isLeader\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"isLeader",
"(",
")",
"{",
"final",
"boolean",
"leading",
"=",
"coordinator",
".",
"isLeader",
"(",
")",
";",
"final"... | This is an unsecured endpoint, defined as such in UNSECURED_PATHS in CoordinatorJettyServerInitializer | [
"This",
"is",
"an",
"unsecured",
"endpoint",
"defined",
"as",
"such",
"in",
"UNSECURED_PATHS",
"in",
"CoordinatorJettyServerInitializer"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/http/CoordinatorResource.java#L70-L82 |
127,572 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java | ParallelIndexSupervisorTask.getMode | @GET
@Path("/mode")
@Produces(MediaType.APPLICATION_JSON)
public Response getMode(@Context final HttpServletRequest req)
{
IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper);
return Response.ok(isParallelMode() ? "parallel" : "sequential").build();
} | java | @GET
@Path("/mode")
@Produces(MediaType.APPLICATION_JSON)
public Response getMode(@Context final HttpServletRequest req)
{
IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper);
return Response.ok(isParallelMode() ? "parallel" : "sequential").build();
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/mode\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"getMode",
"(",
"@",
"Context",
"final",
"HttpServletRequest",
"req",
")",
"{",
"IndexTaskUtils",
".",
"datasourceAuthorization... | External APIs to get running status | [
"External",
"APIs",
"to",
"get",
"running",
"status"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java#L492-L499 |
127,573 | apache/incubator-druid | server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java | HttpServerInventoryView.serverInventoryInitialized | private void serverInventoryInitialized()
{
long start = System.currentTimeMillis();
long serverSyncWaitTimeout = config.getServerTimeout() + 2 * ChangeRequestHttpSyncer.HTTP_TIMEOUT_EXTRA_MS;
List<DruidServerHolder> uninitializedServers = new ArrayList<>();
for (DruidServerHolder server : servers.va... | java | private void serverInventoryInitialized()
{
long start = System.currentTimeMillis();
long serverSyncWaitTimeout = config.getServerTimeout() + 2 * ChangeRequestHttpSyncer.HTTP_TIMEOUT_EXTRA_MS;
List<DruidServerHolder> uninitializedServers = new ArrayList<>();
for (DruidServerHolder server : servers.va... | [
"private",
"void",
"serverInventoryInitialized",
"(",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"serverSyncWaitTimeout",
"=",
"config",
".",
"getServerTimeout",
"(",
")",
"+",
"2",
"*",
"ChangeRequestHttpSyncer",
... | segmentViewInitialized on all registered segment callbacks. | [
"segmentViewInitialized",
"on",
"all",
"registered",
"segment",
"callbacks",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java#L326-L378 |
127,574 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.createSqlType | public static RelDataType createSqlType(final RelDataTypeFactory typeFactory, final SqlTypeName typeName)
{
return createSqlTypeWithNullability(typeFactory, typeName, false);
} | java | public static RelDataType createSqlType(final RelDataTypeFactory typeFactory, final SqlTypeName typeName)
{
return createSqlTypeWithNullability(typeFactory, typeName, false);
} | [
"public",
"static",
"RelDataType",
"createSqlType",
"(",
"final",
"RelDataTypeFactory",
"typeFactory",
",",
"final",
"SqlTypeName",
"typeName",
")",
"{",
"return",
"createSqlTypeWithNullability",
"(",
"typeFactory",
",",
"typeName",
",",
"false",
")",
";",
"}"
] | Like RelDataTypeFactory.createSqlType, but creates types that align best with how Druid represents them. | [
"Like",
"RelDataTypeFactory",
".",
"createSqlType",
"but",
"creates",
"types",
"that",
"align",
"best",
"with",
"how",
"Druid",
"represents",
"them",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L179-L182 |
127,575 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.createSqlTypeWithNullability | public static RelDataType createSqlTypeWithNullability(
final RelDataTypeFactory typeFactory,
final SqlTypeName typeName,
final boolean nullable
)
{
final RelDataType dataType;
switch (typeName) {
case TIMESTAMP:
// Our timestamps are down to the millisecond (precision = 3).... | java | public static RelDataType createSqlTypeWithNullability(
final RelDataTypeFactory typeFactory,
final SqlTypeName typeName,
final boolean nullable
)
{
final RelDataType dataType;
switch (typeName) {
case TIMESTAMP:
// Our timestamps are down to the millisecond (precision = 3).... | [
"public",
"static",
"RelDataType",
"createSqlTypeWithNullability",
"(",
"final",
"RelDataTypeFactory",
"typeFactory",
",",
"final",
"SqlTypeName",
"typeName",
",",
"final",
"boolean",
"nullable",
")",
"{",
"final",
"RelDataType",
"dataType",
";",
"switch",
"(",
"typeN... | Like RelDataTypeFactory.createSqlTypeWithNullability, but creates types that align best with how Druid
represents them. | [
"Like",
"RelDataTypeFactory",
".",
"createSqlTypeWithNullability",
"but",
"creates",
"types",
"that",
"align",
"best",
"with",
"how",
"Druid",
"represents",
"them",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L188-L214 |
127,576 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteTimestamp | public static long jodaToCalciteTimestamp(final DateTime dateTime, final DateTimeZone timeZone)
{
return dateTime.withZone(timeZone).withZoneRetainFields(DateTimeZone.UTC).getMillis();
} | java | public static long jodaToCalciteTimestamp(final DateTime dateTime, final DateTimeZone timeZone)
{
return dateTime.withZone(timeZone).withZoneRetainFields(DateTimeZone.UTC).getMillis();
} | [
"public",
"static",
"long",
"jodaToCalciteTimestamp",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"return",
"dateTime",
".",
"withZone",
"(",
"timeZone",
")",
".",
"withZoneRetainFields",
"(",
"DateTimeZone",
".",
"UTC... | Calcite expects "TIMESTAMP" types to be an instant that has the expected local time fields if printed as UTC.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style millis | [
"Calcite",
"expects",
"TIMESTAMP",
"types",
"to",
"be",
"an",
"instant",
"that",
"has",
"the",
"expected",
"local",
"time",
"fields",
"if",
"printed",
"as",
"UTC",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L224-L227 |
127,577 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteDate | public static int jodaToCalciteDate(final DateTime dateTime, final DateTimeZone timeZone)
{
final DateTime date = dateTime.withZone(timeZone).dayOfMonth().roundFloorCopy();
return Days.daysBetween(DateTimes.EPOCH, date.withZoneRetainFields(DateTimeZone.UTC)).getDays();
} | java | public static int jodaToCalciteDate(final DateTime dateTime, final DateTimeZone timeZone)
{
final DateTime date = dateTime.withZone(timeZone).dayOfMonth().roundFloorCopy();
return Days.daysBetween(DateTimes.EPOCH, date.withZoneRetainFields(DateTimeZone.UTC)).getDays();
} | [
"public",
"static",
"int",
"jodaToCalciteDate",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"final",
"DateTime",
"date",
"=",
"dateTime",
".",
"withZone",
"(",
"timeZone",
")",
".",
"dayOfMonth",
"(",
")",
".",
"... | Calcite expects "DATE" types to be number of days from the epoch to the UTC date matching the local time fields.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style date | [
"Calcite",
"expects",
"DATE",
"types",
"to",
"be",
"number",
"of",
"days",
"from",
"the",
"epoch",
"to",
"the",
"UTC",
"date",
"matching",
"the",
"local",
"time",
"fields",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L237-L241 |
127,578 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteTimestampString | public static TimestampString jodaToCalciteTimestampString(final DateTime dateTime, final DateTimeZone timeZone)
{
// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.
String timestampString = TRAILING_ZEROS
.matcher(CALCITE_TIMESTAMP_PRINTER.print(dateTime... | java | public static TimestampString jodaToCalciteTimestampString(final DateTime dateTime, final DateTimeZone timeZone)
{
// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.
String timestampString = TRAILING_ZEROS
.matcher(CALCITE_TIMESTAMP_PRINTER.print(dateTime... | [
"public",
"static",
"TimestampString",
"jodaToCalciteTimestampString",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.",
"String",
"timestampSt... | Calcite expects TIMESTAMP literals to be represented by TimestampStrings in the local time zone.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style Calendar, appropriate for literals | [
"Calcite",
"expects",
"TIMESTAMP",
"literals",
"to",
"be",
"represented",
"by",
"TimestampStrings",
"in",
"the",
"local",
"time",
"zone",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L251-L258 |
127,579 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteTimeString | public static TimeString jodaToCalciteTimeString(final DateTime dateTime, final DateTimeZone timeZone)
{
// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.
String timeString = TRAILING_ZEROS
.matcher(CALCITE_TIME_PRINTER.print(dateTime.withZone(timeZone))... | java | public static TimeString jodaToCalciteTimeString(final DateTime dateTime, final DateTimeZone timeZone)
{
// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.
String timeString = TRAILING_ZEROS
.matcher(CALCITE_TIME_PRINTER.print(dateTime.withZone(timeZone))... | [
"public",
"static",
"TimeString",
"jodaToCalciteTimeString",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"// The replaceAll is because Calcite doesn't like trailing zeroes in its fractional seconds part.",
"String",
"timeString",
"=",
... | Calcite expects TIME literals to be represented by TimeStrings in the local time zone.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style Calendar, appropriate for literals | [
"Calcite",
"expects",
"TIME",
"literals",
"to",
"be",
"represented",
"by",
"TimeStrings",
"in",
"the",
"local",
"time",
"zone",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L268-L275 |
127,580 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteDateString | public static DateString jodaToCalciteDateString(final DateTime dateTime, final DateTimeZone timeZone)
{
return new DateString(CALCITE_DATE_PRINTER.print(dateTime.withZone(timeZone)));
} | java | public static DateString jodaToCalciteDateString(final DateTime dateTime, final DateTimeZone timeZone)
{
return new DateString(CALCITE_DATE_PRINTER.print(dateTime.withZone(timeZone)));
} | [
"public",
"static",
"DateString",
"jodaToCalciteDateString",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"return",
"new",
"DateString",
"(",
"CALCITE_DATE_PRINTER",
".",
"print",
"(",
"dateTime",
".",
"withZone",
"(",
... | Calcite expects DATE literals to be represented by DateStrings in the local time zone.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style Calendar, appropriate for literals | [
"Calcite",
"expects",
"DATE",
"literals",
"to",
"be",
"represented",
"by",
"DateStrings",
"in",
"the",
"local",
"time",
"zone",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L285-L288 |
127,581 | apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/column/FloatsColumn.java | FloatsColumn.create | public static FloatsColumn create(ColumnarFloats column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new FloatsColumn(column);
} else {
return new FloatsColumnWithNulls(column, nullValueBitmap);
}
} | java | public static FloatsColumn create(ColumnarFloats column, ImmutableBitmap nullValueBitmap)
{
if (nullValueBitmap.isEmpty()) {
return new FloatsColumn(column);
} else {
return new FloatsColumnWithNulls(column, nullValueBitmap);
}
} | [
"public",
"static",
"FloatsColumn",
"create",
"(",
"ColumnarFloats",
"column",
",",
"ImmutableBitmap",
"nullValueBitmap",
")",
"{",
"if",
"(",
"nullValueBitmap",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"FloatsColumn",
"(",
"column",
")",
";",
"}",... | Factory method to create FloatsColumn. | [
"Factory",
"method",
"to",
"create",
"FloatsColumn",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/column/FloatsColumn.java#L36-L43 |
127,582 | apache/incubator-druid | processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java | InDimFilter.getLongPredicateSupplier | private Supplier<DruidLongPredicate> getLongPredicateSupplier()
{
return new Supplier<DruidLongPredicate>()
{
private final Object initLock = new Object();
private DruidLongPredicate predicate;
private void initLongValues()
{
if (predicate != null) {
return;
... | java | private Supplier<DruidLongPredicate> getLongPredicateSupplier()
{
return new Supplier<DruidLongPredicate>()
{
private final Object initLock = new Object();
private DruidLongPredicate predicate;
private void initLongValues()
{
if (predicate != null) {
return;
... | [
"private",
"Supplier",
"<",
"DruidLongPredicate",
">",
"getLongPredicateSupplier",
"(",
")",
"{",
"return",
"new",
"Supplier",
"<",
"DruidLongPredicate",
">",
"(",
")",
"{",
"private",
"final",
"Object",
"initLock",
"=",
"new",
"Object",
"(",
")",
";",
"privat... | This supplier must be thread-safe, since this DimFilter will be accessed in the query runners. | [
"This",
"supplier",
"must",
"be",
"thread",
"-",
"safe",
"since",
"this",
"DimFilter",
"will",
"be",
"accessed",
"in",
"the",
"query",
"runners",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java#L278-L325 |
127,583 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleWithFixedDelay | public static void scheduleWithFixedDelay(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration delay,
final Runnable runnable
)
{
scheduleWithFixedDelay(
exec,
initialDelay,
delay,
new Callable<Signal>()
{
@Ov... | java | public static void scheduleWithFixedDelay(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration delay,
final Runnable runnable
)
{
scheduleWithFixedDelay(
exec,
initialDelay,
delay,
new Callable<Signal>()
{
@Ov... | [
"public",
"static",
"void",
"scheduleWithFixedDelay",
"(",
"final",
"ScheduledExecutorService",
"exec",
",",
"final",
"Duration",
"initialDelay",
",",
"final",
"Duration",
"delay",
",",
"final",
"Runnable",
"runnable",
")",
"{",
"scheduleWithFixedDelay",
"(",
"exec",
... | Run runnable repeatedly with the given delay between calls, after the given
initial delay. Exceptions are caught and logged as errors. | [
"Run",
"runnable",
"repeatedly",
"with",
"the",
"given",
"delay",
"between",
"calls",
"after",
"the",
"given",
"initial",
"delay",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java#L39-L60 |
127,584 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleWithFixedDelay | public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Callable<Signal> callable)
{
scheduleWithFixedDelay(exec, delay, delay, callable);
} | java | public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Callable<Signal> callable)
{
scheduleWithFixedDelay(exec, delay, delay, callable);
} | [
"public",
"static",
"void",
"scheduleWithFixedDelay",
"(",
"ScheduledExecutorService",
"exec",
",",
"Duration",
"delay",
",",
"Callable",
"<",
"Signal",
">",
"callable",
")",
"{",
"scheduleWithFixedDelay",
"(",
"exec",
",",
"delay",
",",
"delay",
",",
"callable",
... | Run callable repeatedly with the given delay between calls, after the given
initial delay, until it returns Signal.STOP. Exceptions are caught and
logged as errors. | [
"Run",
"callable",
"repeatedly",
"with",
"the",
"given",
"delay",
"between",
"calls",
"after",
"the",
"given",
"initial",
"delay",
"until",
"it",
"returns",
"Signal",
".",
"STOP",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java#L67-L70 |
127,585 | apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleAtFixedRate | public static void scheduleAtFixedRate(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration period,
final Runnable runnable
)
{
scheduleAtFixedRate(exec, initialDelay, period, new Callable<Signal>()
{
@Override
public Signal call()
{
... | java | public static void scheduleAtFixedRate(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration period,
final Runnable runnable
)
{
scheduleAtFixedRate(exec, initialDelay, period, new Callable<Signal>()
{
@Override
public Signal call()
{
... | [
"public",
"static",
"void",
"scheduleAtFixedRate",
"(",
"final",
"ScheduledExecutorService",
"exec",
",",
"final",
"Duration",
"initialDelay",
",",
"final",
"Duration",
"period",
",",
"final",
"Runnable",
"runnable",
")",
"{",
"scheduleAtFixedRate",
"(",
"exec",
","... | Run runnable once every period, after the given initial delay. Exceptions
are caught and logged as errors. | [
"Run",
"runnable",
"once",
"every",
"period",
"after",
"the",
"given",
"initial",
"delay",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java#L113-L129 |
127,586 | apache/incubator-druid | server/src/main/java/org/apache/druid/server/JettyUtils.java | JettyUtils.concatenateForRewrite | public static String concatenateForRewrite(
final String base,
final String encodedPath,
@Nullable final String encodedQueryString
)
{
// Query string and path are already encoded, no need for anything fancy beyond string concatenation.
final StringBuilder url = new StringBuilder(base).ap... | java | public static String concatenateForRewrite(
final String base,
final String encodedPath,
@Nullable final String encodedQueryString
)
{
// Query string and path are already encoded, no need for anything fancy beyond string concatenation.
final StringBuilder url = new StringBuilder(base).ap... | [
"public",
"static",
"String",
"concatenateForRewrite",
"(",
"final",
"String",
"base",
",",
"final",
"String",
"encodedPath",
",",
"@",
"Nullable",
"final",
"String",
"encodedQueryString",
")",
"{",
"// Query string and path are already encoded, no need for anything fancy bey... | Concatenate URI parts, in a way that is useful for proxy servlets.
@param base base part of the uri, like http://example.com (no trailing slash)
@param encodedPath encoded path, like you would get from HttpServletRequest's getRequestURI
@param encodedQueryString encoded query string, like you woul... | [
"Concatenate",
"URI",
"parts",
"in",
"a",
"way",
"that",
"is",
"useful",
"for",
"proxy",
"servlets",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/JettyUtils.java#L33-L48 |
127,587 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.stop | @LifecycleStop
public void stop()
{
giant.lock();
try {
tasks.clear();
taskFutures.clear();
active = false;
managerExec.shutdownNow();
storageSyncExec.shutdownNow();
managementMayBeNecessary.signalAll();
}
finally {
giant.unlock();
}
} | java | @LifecycleStop
public void stop()
{
giant.lock();
try {
tasks.clear();
taskFutures.clear();
active = false;
managerExec.shutdownNow();
storageSyncExec.shutdownNow();
managementMayBeNecessary.signalAll();
}
finally {
giant.unlock();
}
} | [
"@",
"LifecycleStop",
"public",
"void",
"stop",
"(",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"tasks",
".",
"clear",
"(",
")",
";",
"taskFutures",
".",
"clear",
"(",
")",
";",
"active",
"=",
"false",
";",
"managerExec",
".",
"shut... | Shuts down the queue. | [
"Shuts",
"down",
"the",
"queue",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L205-L221 |
127,588 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.manage | private void manage() throws InterruptedException
{
log.info("Beginning management in %s.", config.getStartDelay());
Thread.sleep(config.getStartDelay().getMillis());
// Ignore return value- we'll get the IDs and futures from getKnownTasks later.
taskRunner.restore();
while (active) {
gian... | java | private void manage() throws InterruptedException
{
log.info("Beginning management in %s.", config.getStartDelay());
Thread.sleep(config.getStartDelay().getMillis());
// Ignore return value- we'll get the IDs and futures from getKnownTasks later.
taskRunner.restore();
while (active) {
gian... | [
"private",
"void",
"manage",
"(",
")",
"throws",
"InterruptedException",
"{",
"log",
".",
"info",
"(",
"\"Beginning management in %s.\"",
",",
"config",
".",
"getStartDelay",
"(",
")",
")",
";",
"Thread",
".",
"sleep",
"(",
"config",
".",
"getStartDelay",
"(",... | Main task runner management loop. Meant to run forever, or, at least until we're stopped. | [
"Main",
"task",
"runner",
"management",
"loop",
".",
"Meant",
"to",
"run",
"forever",
"or",
"at",
"least",
"until",
"we",
"re",
"stopped",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L231-L321 |
127,589 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.add | public boolean add(final Task task) throws EntryExistsException
{
if (taskStorage.getTask(task.getId()).isPresent()) {
throw new EntryExistsException(StringUtils.format("Task %s is already exists", task.getId()));
}
giant.lock();
try {
Preconditions.checkState(active, "Queue is not activ... | java | public boolean add(final Task task) throws EntryExistsException
{
if (taskStorage.getTask(task.getId()).isPresent()) {
throw new EntryExistsException(StringUtils.format("Task %s is already exists", task.getId()));
}
giant.lock();
try {
Preconditions.checkState(active, "Queue is not activ... | [
"public",
"boolean",
"add",
"(",
"final",
"Task",
"task",
")",
"throws",
"EntryExistsException",
"{",
"if",
"(",
"taskStorage",
".",
"getTask",
"(",
"task",
".",
"getId",
"(",
")",
")",
".",
"isPresent",
"(",
")",
")",
"{",
"throw",
"new",
"EntryExistsEx... | Adds some work to the queue and the underlying task storage facility with a generic "running" status.
@param task task to add
@return true
@throws EntryExistsException if the task already exists | [
"Adds",
"some",
"work",
"to",
"the",
"queue",
"and",
"the",
"underlying",
"task",
"storage",
"facility",
"with",
"a",
"generic",
"running",
"status",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L339-L362 |
127,590 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.shutdown | public void shutdown(final String taskId, String reasonFormat, Object... args)
{
giant.lock();
try {
Preconditions.checkNotNull(taskId, "taskId");
for (final Task task : tasks) {
if (task.getId().equals(taskId)) {
notifyStatus(task, TaskStatus.failure(taskId), reasonFormat, args... | java | public void shutdown(final String taskId, String reasonFormat, Object... args)
{
giant.lock();
try {
Preconditions.checkNotNull(taskId, "taskId");
for (final Task task : tasks) {
if (task.getId().equals(taskId)) {
notifyStatus(task, TaskStatus.failure(taskId), reasonFormat, args... | [
"public",
"void",
"shutdown",
"(",
"final",
"String",
"taskId",
",",
"String",
"reasonFormat",
",",
"Object",
"...",
"args",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"taskId",
",",
"\"taskId\"",
... | Shuts down a task if it has not yet finished.
@param taskId task to kill | [
"Shuts",
"down",
"a",
"task",
"if",
"it",
"has",
"not",
"yet",
"finished",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L383-L399 |
127,591 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.notifyStatus | private void notifyStatus(final Task task, final TaskStatus taskStatus, String reasonFormat, Object... args)
{
giant.lock();
try {
Preconditions.checkNotNull(task, "task");
Preconditions.checkNotNull(taskStatus, "status");
Preconditions.checkState(active, "Queue is not active!");
Prec... | java | private void notifyStatus(final Task task, final TaskStatus taskStatus, String reasonFormat, Object... args)
{
giant.lock();
try {
Preconditions.checkNotNull(task, "task");
Preconditions.checkNotNull(taskStatus, "status");
Preconditions.checkState(active, "Queue is not active!");
Prec... | [
"private",
"void",
"notifyStatus",
"(",
"final",
"Task",
"task",
",",
"final",
"TaskStatus",
"taskStatus",
",",
"String",
"reasonFormat",
",",
"Object",
"...",
"args",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Preconditions",
".",
"checkN... | Notify this queue that some task has an updated status. If this update is valid, the status will be persisted in
the task storage facility. If the status is a completed status, the task will be unlocked and no further
updates will be accepted.
@param task task to update
@param taskStatus new task status
@throws... | [
"Notify",
"this",
"queue",
"that",
"some",
"task",
"has",
"an",
"updated",
"status",
".",
"If",
"this",
"update",
"is",
"valid",
"the",
"status",
"will",
"be",
"persisted",
"in",
"the",
"task",
"storage",
"facility",
".",
"If",
"the",
"status",
"is",
"a"... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L413-L473 |
127,592 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.attachCallbacks | private ListenableFuture<TaskStatus> attachCallbacks(final Task task, final ListenableFuture<TaskStatus> statusFuture)
{
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
IndexTaskUtils.setTaskDimensions(metricBuilder, task);
Futures.addCallback(
statusFuture,
... | java | private ListenableFuture<TaskStatus> attachCallbacks(final Task task, final ListenableFuture<TaskStatus> statusFuture)
{
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
IndexTaskUtils.setTaskDimensions(metricBuilder, task);
Futures.addCallback(
statusFuture,
... | [
"private",
"ListenableFuture",
"<",
"TaskStatus",
">",
"attachCallbacks",
"(",
"final",
"Task",
"task",
",",
"final",
"ListenableFuture",
"<",
"TaskStatus",
">",
"statusFuture",
")",
"{",
"final",
"ServiceMetricEvent",
".",
"Builder",
"metricBuilder",
"=",
"new",
... | Attach success and failure handlers to a task status future, such that when it completes, we perform the
appropriate updates.
@param statusFuture a task status future
@return the same future, for convenience | [
"Attach",
"success",
"and",
"failure",
"handlers",
"to",
"a",
"task",
"status",
"future",
"such",
"that",
"when",
"it",
"completes",
"we",
"perform",
"the",
"appropriate",
"updates",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L483-L551 |
127,593 | apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | TaskQueue.syncFromStorage | private void syncFromStorage()
{
giant.lock();
try {
if (active) {
final Map<String, Task> newTasks = toTaskIDMap(taskStorage.getActiveTasks());
final int tasksSynced = newTasks.size();
final Map<String, Task> oldTasks = toTaskIDMap(tasks);
// Calculate differences on I... | java | private void syncFromStorage()
{
giant.lock();
try {
if (active) {
final Map<String, Task> newTasks = toTaskIDMap(taskStorage.getActiveTasks());
final int tasksSynced = newTasks.size();
final Map<String, Task> oldTasks = toTaskIDMap(tasks);
// Calculate differences on I... | [
"private",
"void",
"syncFromStorage",
"(",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"active",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Task",
">",
"newTasks",
"=",
"toTaskIDMap",
"(",
"taskStorage",
".",
"getActiveTas... | Resync the contents of this task queue with our storage facility. Useful to make sure our in-memory state
corresponds to the storage facility even if the latter is manually modified. | [
"Resync",
"the",
"contents",
"of",
"this",
"task",
"queue",
"with",
"our",
"storage",
"facility",
".",
"Useful",
"to",
"make",
"sure",
"our",
"in",
"-",
"memory",
"state",
"corresponds",
"to",
"the",
"storage",
"facility",
"even",
"if",
"the",
"latter",
"i... | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java#L557-L604 |
127,594 | apache/incubator-druid | extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java | ConciseSet.appendFill | private void appendFill(int length, int fillType)
{
assert length > 0;
assert lastWordIndex >= -1;
fillType &= ConciseSetUtils.SEQUENCE_BIT;
// it is actually a literal...
if (length == 1) {
appendLiteral(fillType == 0 ? ConciseSetUtils.ALL_ZEROS_LITERAL : ConciseSetUtils.ALL_ONES... | java | private void appendFill(int length, int fillType)
{
assert length > 0;
assert lastWordIndex >= -1;
fillType &= ConciseSetUtils.SEQUENCE_BIT;
// it is actually a literal...
if (length == 1) {
appendLiteral(fillType == 0 ? ConciseSetUtils.ALL_ZEROS_LITERAL : ConciseSetUtils.ALL_ONES... | [
"private",
"void",
"appendFill",
"(",
"int",
"length",
",",
"int",
"fillType",
")",
"{",
"assert",
"length",
">",
"0",
";",
"assert",
"lastWordIndex",
">=",
"-",
"1",
";",
"fillType",
"&=",
"ConciseSetUtils",
".",
"SEQUENCE_BIT",
";",
"// it is actually a lite... | Append a sequence word after the last word
@param length sequence length
@param fillType sequence word with a count that equals 0 | [
"Append",
"a",
"sequence",
"word",
"after",
"the",
"last",
"word"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java#L544-L588 |
127,595 | apache/incubator-druid | extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java | ConciseSet.trimZeros | private void trimZeros()
{
// loop over ALL_ZEROS_LITERAL words
int w;
do {
w = words[lastWordIndex];
if (w == ConciseSetUtils.ALL_ZEROS_LITERAL) {
lastWordIndex--;
} else if (isZeroSequence(w)) {
if (simulateWAH || isSequenceWithNoBits(w)) {
lastWordI... | java | private void trimZeros()
{
// loop over ALL_ZEROS_LITERAL words
int w;
do {
w = words[lastWordIndex];
if (w == ConciseSetUtils.ALL_ZEROS_LITERAL) {
lastWordIndex--;
} else if (isZeroSequence(w)) {
if (simulateWAH || isSequenceWithNoBits(w)) {
lastWordI... | [
"private",
"void",
"trimZeros",
"(",
")",
"{",
"// loop over ALL_ZEROS_LITERAL words\r",
"int",
"w",
";",
"do",
"{",
"w",
"=",
"words",
"[",
"lastWordIndex",
"]",
";",
"if",
"(",
"w",
"==",
"ConciseSetUtils",
".",
"ALL_ZEROS_LITERAL",
")",
"{",
"lastWordIndex"... | Removes trailing zeros | [
"Removes",
"trailing",
"zeros"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java#L765-L790 |
127,596 | apache/incubator-druid | extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java | ConciseSet.writeObject | private void writeObject(ObjectOutputStream s) throws IOException
{
if (words != null && lastWordIndex < words.length - 1) {
// compact before serializing
words = Arrays.copyOf(words, lastWordIndex + 1);
}
s.defaultWriteObject();
} | java | private void writeObject(ObjectOutputStream s) throws IOException
{
if (words != null && lastWordIndex < words.length - 1) {
// compact before serializing
words = Arrays.copyOf(words, lastWordIndex + 1);
}
s.defaultWriteObject();
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"words",
"!=",
"null",
"&&",
"lastWordIndex",
"<",
"words",
".",
"length",
"-",
"1",
")",
"{",
"// compact before serializing\r",
"words",
"=",
"Arr... | Save the state of the instance to a stream | [
"Save",
"the",
"state",
"of",
"the",
"instance",
"to",
"a",
"stream"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java#L1384-L1391 |
127,597 | apache/incubator-druid | extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java | ConciseSet.readObject | private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
{
s.defaultReadObject();
if (words == null) {
reset();
return;
}
lastWordIndex = words.length - 1;
updateLast();
size = -1;
} | java | private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
{
s.defaultReadObject();
if (words == null) {
reset();
return;
}
lastWordIndex = words.length - 1;
updateLast();
size = -1;
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"s",
".",
"defaultReadObject",
"(",
")",
";",
"if",
"(",
"words",
"==",
"null",
")",
"{",
"reset",
"(",
")",
";",
"return",
";... | Reconstruct the instance from a stream | [
"Reconstruct",
"the",
"instance",
"from",
"a",
"stream"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extendedset/src/main/java/org/apache/druid/extendedset/intset/ConciseSet.java#L1396-L1406 |
127,598 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rule/GroupByRules.java | GroupByRules.translateAggregateCall | public static Aggregation translateAggregateCall(
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexBuilder rexBuilder,
final Project project,
final List<Aggregation> existingAggregations,
final String name,
final AggregateCall call,
... | java | public static Aggregation translateAggregateCall(
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexBuilder rexBuilder,
final Project project,
final List<Aggregation> existingAggregations,
final String name,
final AggregateCall call,
... | [
"public",
"static",
"Aggregation",
"translateAggregateCall",
"(",
"final",
"PlannerContext",
"plannerContext",
",",
"final",
"DruidQuerySignature",
"querySignature",
",",
"final",
"RexBuilder",
"rexBuilder",
",",
"final",
"Project",
"project",
",",
"final",
"List",
"<",... | Translate an AggregateCall to Druid equivalents.
@return translated aggregation, or null if translation failed. | [
"Translate",
"an",
"AggregateCall",
"to",
"Druid",
"equivalents",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rule/GroupByRules.java#L53-L140 |
127,599 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rule/GroupByRules.java | GroupByRules.isUsingExistingAggregation | private static boolean isUsingExistingAggregation(
final Aggregation aggregation,
final List<Aggregation> existingAggregations
)
{
if (!aggregation.getAggregatorFactories().isEmpty()) {
return false;
}
final Set<String> existingAggregationNames = existingAggregations
.stream()... | java | private static boolean isUsingExistingAggregation(
final Aggregation aggregation,
final List<Aggregation> existingAggregations
)
{
if (!aggregation.getAggregatorFactories().isEmpty()) {
return false;
}
final Set<String> existingAggregationNames = existingAggregations
.stream()... | [
"private",
"static",
"boolean",
"isUsingExistingAggregation",
"(",
"final",
"Aggregation",
"aggregation",
",",
"final",
"List",
"<",
"Aggregation",
">",
"existingAggregations",
")",
"{",
"if",
"(",
"!",
"aggregation",
".",
"getAggregatorFactories",
"(",
")",
".",
... | Checks if "aggregation" is exclusively based on existing aggregations from "existingAggregations'. | [
"Checks",
"if",
"aggregation",
"is",
"exclusively",
"based",
"on",
"existing",
"aggregations",
"from",
"existingAggregations",
"."
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rule/GroupByRules.java#L145-L161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.