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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
123,000 | apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.insertRecord | public void insertRecord(
Object recordBase, long recordOffset, int length, long prefix, boolean prefixIsNull)
throws IOException {
assert(inMemSorter != null);
if (inMemSorter.numRecords() >= numElementsForSpillThreshold) {
logger.info("Spilling data because number of spilledRecords crossed th... | java | public void insertRecord(
Object recordBase, long recordOffset, int length, long prefix, boolean prefixIsNull)
throws IOException {
assert(inMemSorter != null);
if (inMemSorter.numRecords() >= numElementsForSpillThreshold) {
logger.info("Spilling data because number of spilledRecords crossed th... | [
"public",
"void",
"insertRecord",
"(",
"Object",
"recordBase",
",",
"long",
"recordOffset",
",",
"int",
"length",
",",
"long",
"prefix",
",",
"boolean",
"prefixIsNull",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"inMemSorter",
"!=",
"null",
")",
";",
... | Write a record to the sorter. | [
"Write",
"a",
"record",
"to",
"the",
"sorter",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L390-L414 |
123,001 | apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.merge | public void merge(UnsafeExternalSorter other) throws IOException {
other.spill();
spillWriters.addAll(other.spillWriters);
// remove them from `spillWriters`, or the files will be deleted in `cleanupResources`.
other.spillWriters.clear();
other.cleanupResources();
} | java | public void merge(UnsafeExternalSorter other) throws IOException {
other.spill();
spillWriters.addAll(other.spillWriters);
// remove them from `spillWriters`, or the files will be deleted in `cleanupResources`.
other.spillWriters.clear();
other.cleanupResources();
} | [
"public",
"void",
"merge",
"(",
"UnsafeExternalSorter",
"other",
")",
"throws",
"IOException",
"{",
"other",
".",
"spill",
"(",
")",
";",
"spillWriters",
".",
"addAll",
"(",
"other",
".",
"spillWriters",
")",
";",
"// remove them from `spillWriters`, or the files wi... | Merges another UnsafeExternalSorters into this one, the other one will be emptied.
@throws IOException | [
"Merges",
"another",
"UnsafeExternalSorters",
"into",
"this",
"one",
"the",
"other",
"one",
"will",
"be",
"emptied",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L453-L459 |
123,002 | apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.getIterator | public UnsafeSorterIterator getIterator(int startIndex) throws IOException {
if (spillWriters.isEmpty()) {
assert(inMemSorter != null);
UnsafeSorterIterator iter = inMemSorter.getSortedIterator();
moveOver(iter, startIndex);
return iter;
} else {
LinkedList<UnsafeSorterIterator> qu... | java | public UnsafeSorterIterator getIterator(int startIndex) throws IOException {
if (spillWriters.isEmpty()) {
assert(inMemSorter != null);
UnsafeSorterIterator iter = inMemSorter.getSortedIterator();
moveOver(iter, startIndex);
return iter;
} else {
LinkedList<UnsafeSorterIterator> qu... | [
"public",
"UnsafeSorterIterator",
"getIterator",
"(",
"int",
"startIndex",
")",
"throws",
"IOException",
"{",
"if",
"(",
"spillWriters",
".",
"isEmpty",
"(",
")",
")",
"{",
"assert",
"(",
"inMemSorter",
"!=",
"null",
")",
";",
"UnsafeSorterIterator",
"iter",
"... | Returns an iterator starts from startIndex, which will return the rows in the order as
inserted.
It is the caller's responsibility to call `cleanupResources()`
after consuming this iterator.
TODO: support forced spilling | [
"Returns",
"an",
"iterator",
"starts",
"from",
"startIndex",
"which",
"will",
"return",
"the",
"rows",
"in",
"the",
"order",
"as",
"inserted",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L634-L658 |
123,003 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/BufferHolder.java | BufferHolder.grow | void grow(int neededSize) {
if (neededSize < 0) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size is negative");
}
if (neededSize > ARRAY_MAX - totalSize()) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder b... | java | void grow(int neededSize) {
if (neededSize < 0) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size is negative");
}
if (neededSize > ARRAY_MAX - totalSize()) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder b... | [
"void",
"grow",
"(",
"int",
"neededSize",
")",
"{",
"if",
"(",
"neededSize",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot grow BufferHolder by size \"",
"+",
"neededSize",
"+",
"\" because the size is negative\"",
")",
";",
"}",
"... | Grows the buffer by at least neededSize and points the row to the buffer. | [
"Grows",
"the",
"buffer",
"by",
"at",
"least",
"neededSize",
"and",
"points",
"the",
"row",
"to",
"the",
"buffer",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/BufferHolder.java#L65-L90 |
123,004 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java | SparkSaslClient.firstToken | public synchronized byte[] firstToken() {
if (saslClient != null && saslClient.hasInitialResponse()) {
try {
return saslClient.evaluateChallenge(new byte[0]);
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} else {
return new byte[0];
}
} | java | public synchronized byte[] firstToken() {
if (saslClient != null && saslClient.hasInitialResponse()) {
try {
return saslClient.evaluateChallenge(new byte[0]);
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} else {
return new byte[0];
}
} | [
"public",
"synchronized",
"byte",
"[",
"]",
"firstToken",
"(",
")",
"{",
"if",
"(",
"saslClient",
"!=",
"null",
"&&",
"saslClient",
".",
"hasInitialResponse",
"(",
")",
")",
"{",
"try",
"{",
"return",
"saslClient",
".",
"evaluateChallenge",
"(",
"new",
"by... | Used to initiate SASL handshake with server. | [
"Used",
"to",
"initiate",
"SASL",
"handshake",
"with",
"server",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java#L69-L79 |
123,005 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java | SparkSaslClient.response | public synchronized byte[] response(byte[] token) {
try {
return saslClient != null ? saslClient.evaluateChallenge(token) : new byte[0];
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} | java | public synchronized byte[] response(byte[] token) {
try {
return saslClient != null ? saslClient.evaluateChallenge(token) : new byte[0];
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} | [
"public",
"synchronized",
"byte",
"[",
"]",
"response",
"(",
"byte",
"[",
"]",
"token",
")",
"{",
"try",
"{",
"return",
"saslClient",
"!=",
"null",
"?",
"saslClient",
".",
"evaluateChallenge",
"(",
"token",
")",
":",
"new",
"byte",
"[",
"0",
"]",
";",
... | Respond to server's SASL token.
@param token contains server's SASL token
@return client's response SASL token | [
"Respond",
"to",
"server",
"s",
"SASL",
"token",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java#L96-L102 |
123,006 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java | SparkSaslClient.dispose | @Override
public synchronized void dispose() {
if (saslClient != null) {
try {
saslClient.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslClient = null;
}
}
} | java | @Override
public synchronized void dispose() {
if (saslClient != null) {
try {
saslClient.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslClient = null;
}
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"saslClient",
"!=",
"null",
")",
"{",
"try",
"{",
"saslClient",
".",
"dispose",
"(",
")",
";",
"}",
"catch",
"(",
"SaslException",
"e",
")",
"{",
"// ignore",
"}",
... | Disposes of any system resources or security-sensitive information the
SaslClient might be using. | [
"Disposes",
"of",
"any",
"system",
"resources",
"or",
"security",
"-",
"sensitive",
"information",
"the",
"SaslClient",
"might",
"be",
"using",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java#L108-L119 |
123,007 | apache/spark | common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java | YarnShuffleServiceMetrics.getMetrics | @Override
public void getMetrics(MetricsCollector collector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = collector.addRecord("sparkShuffleService");
for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
collectMetric(metricsRecordBuilder, entry.getKey(), entry.getVa... | java | @Override
public void getMetrics(MetricsCollector collector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = collector.addRecord("sparkShuffleService");
for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
collectMetric(metricsRecordBuilder, entry.getKey(), entry.getVa... | [
"@",
"Override",
"public",
"void",
"getMetrics",
"(",
"MetricsCollector",
"collector",
",",
"boolean",
"all",
")",
"{",
"MetricsRecordBuilder",
"metricsRecordBuilder",
"=",
"collector",
".",
"addRecord",
"(",
"\"sparkShuffleService\"",
")",
";",
"for",
"(",
"Map",
... | Get metrics from the source
@param collector to contain the resulting metrics snapshot
@param all if true, return all metrics even if unchanged. | [
"Get",
"metrics",
"from",
"the",
"source"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java#L47-L54 |
123,008 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java | CryptoUtils.toCryptoConf | public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) {
Properties props = new Properties();
for (Map.Entry<String, String> e : conf) {
String key = e.getKey();
if (key.startsWith(prefix)) {
props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substri... | java | public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) {
Properties props = new Properties();
for (Map.Entry<String, String> e : conf) {
String key = e.getKey();
if (key.startsWith(prefix)) {
props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substri... | [
"public",
"static",
"Properties",
"toCryptoConf",
"(",
"String",
"prefix",
",",
"Iterable",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"conf",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
... | Extract the commons-crypto configuration embedded in a list of config values.
@param prefix Prefix in the given configuration that identifies the commons-crypto configs.
@param conf List of configuration values. | [
"Extract",
"the",
"commons",
"-",
"crypto",
"configuration",
"embedded",
"in",
"a",
"list",
"of",
"config",
"values",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java#L37-L47 |
123,009 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getBooleans | public boolean[] getBooleans(int rowId, int count) {
boolean[] res = new boolean[count];
for (int i = 0; i < count; i++) {
res[i] = getBoolean(rowId + i);
}
return res;
} | java | public boolean[] getBooleans(int rowId, int count) {
boolean[] res = new boolean[count];
for (int i = 0; i < count; i++) {
res[i] = getBoolean(rowId + i);
}
return res;
} | [
"public",
"boolean",
"[",
"]",
"getBooleans",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"boolean",
"[",
"]",
"res",
"=",
"new",
"boolean",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++... | Gets boolean type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"boolean",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L92-L98 |
123,010 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getBytes | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | java | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | [
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"byte",
"[",
"]",
"res",
"=",
"new",
"byte",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
... | Gets byte type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"byte",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L110-L116 |
123,011 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getShorts | public short[] getShorts(int rowId, int count) {
short[] res = new short[count];
for (int i = 0; i < count; i++) {
res[i] = getShort(rowId + i);
}
return res;
} | java | public short[] getShorts(int rowId, int count) {
short[] res = new short[count];
for (int i = 0; i < count; i++) {
res[i] = getShort(rowId + i);
}
return res;
} | [
"public",
"short",
"[",
"]",
"getShorts",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"short",
"[",
"]",
"res",
"=",
"new",
"short",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")"... | Gets short type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"short",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L128-L134 |
123,012 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getInts | public int[] getInts(int rowId, int count) {
int[] res = new int[count];
for (int i = 0; i < count; i++) {
res[i] = getInt(rowId + i);
}
return res;
} | java | public int[] getInts(int rowId, int count) {
int[] res = new int[count];
for (int i = 0; i < count; i++) {
res[i] = getInt(rowId + i);
}
return res;
} | [
"public",
"int",
"[",
"]",
"getInts",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"int",
"[",
"]",
"res",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",... | Gets int type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"int",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L146-L152 |
123,013 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getLongs | public long[] getLongs(int rowId, int count) {
long[] res = new long[count];
for (int i = 0; i < count; i++) {
res[i] = getLong(rowId + i);
}
return res;
} | java | public long[] getLongs(int rowId, int count) {
long[] res = new long[count];
for (int i = 0; i < count; i++) {
res[i] = getLong(rowId + i);
}
return res;
} | [
"public",
"long",
"[",
"]",
"getLongs",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"long",
"[",
"]",
"res",
"=",
"new",
"long",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
... | Gets long type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"long",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L164-L170 |
123,014 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getFloats | public float[] getFloats(int rowId, int count) {
float[] res = new float[count];
for (int i = 0; i < count; i++) {
res[i] = getFloat(rowId + i);
}
return res;
} | java | public float[] getFloats(int rowId, int count) {
float[] res = new float[count];
for (int i = 0; i < count; i++) {
res[i] = getFloat(rowId + i);
}
return res;
} | [
"public",
"float",
"[",
"]",
"getFloats",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"float",
"[",
"]",
"res",
"=",
"new",
"float",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")"... | Gets float type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"float",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L182-L188 |
123,015 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getDoubles | public double[] getDoubles(int rowId, int count) {
double[] res = new double[count];
for (int i = 0; i < count; i++) {
res[i] = getDouble(rowId + i);
}
return res;
} | java | public double[] getDoubles(int rowId, int count) {
double[] res = new double[count];
for (int i = 0; i < count; i++) {
res[i] = getDouble(rowId + i);
}
return res;
} | [
"public",
"double",
"[",
"]",
"getDoubles",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"double",
"[",
"]",
"res",
"=",
"new",
"double",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
... | Gets double type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"double",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L200-L206 |
123,016 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getInterval | public final CalendarInterval getInterval(int rowId) {
if (isNullAt(rowId)) return null;
final int months = getChild(0).getInt(rowId);
final long microseconds = getChild(1).getLong(rowId);
return new CalendarInterval(months, microseconds);
} | java | public final CalendarInterval getInterval(int rowId) {
if (isNullAt(rowId)) return null;
final int months = getChild(0).getInt(rowId);
final long microseconds = getChild(1).getLong(rowId);
return new CalendarInterval(months, microseconds);
} | [
"public",
"final",
"CalendarInterval",
"getInterval",
"(",
"int",
"rowId",
")",
"{",
"if",
"(",
"isNullAt",
"(",
"rowId",
")",
")",
"return",
"null",
";",
"final",
"int",
"months",
"=",
"getChild",
"(",
"0",
")",
".",
"getInt",
"(",
"rowId",
")",
";",
... | Returns the calendar interval type value for rowId. If the slot for rowId is null, it should
return null.
In Spark, calendar interval type value is basically an integer value representing the number of
months in this interval, and a long value representing the number of microseconds in this
interval. An interval type ... | [
"Returns",
"the",
"calendar",
"interval",
"type",
"value",
"for",
"rowId",
".",
"If",
"the",
"slot",
"for",
"rowId",
"is",
"null",
"it",
"should",
"return",
"null",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L280-L285 |
123,017 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.getAuthProcFactory | public TProcessorFactory getAuthProcFactory(ThriftCLIService service) throws LoginException {
if (authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
} else {
return PlainSaslHelper.getPlainProcessorFactory(ser... | java | public TProcessorFactory getAuthProcFactory(ThriftCLIService service) throws LoginException {
if (authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
} else {
return PlainSaslHelper.getPlainProcessorFactory(ser... | [
"public",
"TProcessorFactory",
"getAuthProcFactory",
"(",
"ThriftCLIService",
"service",
")",
"throws",
"LoginException",
"{",
"if",
"(",
"authTypeStr",
".",
"equalsIgnoreCase",
"(",
"AuthTypes",
".",
"KERBEROS",
".",
"getAuthName",
"(",
")",
")",
")",
"{",
"retur... | Returns the thrift processor factory for HiveServer2 running in binary mode
@param service
@return
@throws LoginException | [
"Returns",
"the",
"thrift",
"processor",
"factory",
"for",
"HiveServer2",
"running",
"in",
"binary",
"mode"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L205-L211 |
123,018 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.loginFromKeytab | public static void loginFromKeytab(HiveConf hiveConf) throws IOException {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (principal.isEmpty() || keyTabFile.isEmpty()) {
throw new IOException(... | java | public static void loginFromKeytab(HiveConf hiveConf) throws IOException {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (principal.isEmpty() || keyTabFile.isEmpty()) {
throw new IOException(... | [
"public",
"static",
"void",
"loginFromKeytab",
"(",
"HiveConf",
"hiveConf",
")",
"throws",
"IOException",
"{",
"String",
"principal",
"=",
"hiveConf",
".",
"getVar",
"(",
"ConfVars",
".",
"HIVE_SERVER2_KERBEROS_PRINCIPAL",
")",
";",
"String",
"keyTabFile",
"=",
"h... | Perform kerberos login using the hadoop shim API if the configuration is available | [
"Perform",
"kerberos",
"login",
"using",
"the",
"hadoop",
"shim",
"API",
"if",
"the",
"configuration",
"is",
"available"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L226-L234 |
123,019 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.loginFromSpnegoKeytabAndReturnUGI | public static UserGroupInformation loginFromSpnegoKeytabAndReturnUGI(HiveConf hiveConf)
throws IOException {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL);
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB);
if (principal.isEmpty() || keyTabFile.isEmpty... | java | public static UserGroupInformation loginFromSpnegoKeytabAndReturnUGI(HiveConf hiveConf)
throws IOException {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL);
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB);
if (principal.isEmpty() || keyTabFile.isEmpty... | [
"public",
"static",
"UserGroupInformation",
"loginFromSpnegoKeytabAndReturnUGI",
"(",
"HiveConf",
"hiveConf",
")",
"throws",
"IOException",
"{",
"String",
"principal",
"=",
"hiveConf",
".",
"getVar",
"(",
"ConfVars",
".",
"HIVE_SERVER2_SPNEGO_PRINCIPAL",
")",
";",
"Stri... | Perform SPNEGO login using the hadoop shim API if the configuration is available | [
"Perform",
"SPNEGO",
"login",
"using",
"the",
"hadoop",
"shim",
"API",
"if",
"the",
"configuration",
"is",
"available"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L237-L246 |
123,020 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.getDelegationToken | public String getDelegationToken(String owner, String renewer) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
String tokenStr = saslServer.getDelegationTokenWithService(o... | java | public String getDelegationToken(String owner, String renewer) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
String tokenStr = saslServer.getDelegationTokenWithService(o... | [
"public",
"String",
"getDelegationToken",
"(",
"String",
"owner",
",",
"String",
"renewer",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"saslServer",
"==",
"null",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"Delegation token only supported over kerber... | retrieve delegation token for the given user | [
"retrieve",
"delegation",
"token",
"for",
"the",
"given",
"user"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L315-L334 |
123,021 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.cancelDelegationToken | public void cancelDelegationToken(String delegationToken) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
saslServer.cancelDelegationToken(delegationToken);
} catch (IO... | java | public void cancelDelegationToken(String delegationToken) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
saslServer.cancelDelegationToken(delegationToken);
} catch (IO... | [
"public",
"void",
"cancelDelegationToken",
"(",
"String",
"delegationToken",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"saslServer",
"==",
"null",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"Delegation token only supported over kerberos authentication\"",... | cancel given delegation token | [
"cancel",
"given",
"delegation",
"token"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L337-L348 |
123,022 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIServiceUtils.java | CLIServiceUtils.patternToRegex | public static String patternToRegex(String pattern) {
if (pattern == null) {
return ".*";
} else {
StringBuilder result = new StringBuilder(pattern.length());
boolean escaped = false;
for (int i = 0, len = pattern.length(); i < len; i++) {
char c = pattern.charAt(i);
if ... | java | public static String patternToRegex(String pattern) {
if (pattern == null) {
return ".*";
} else {
StringBuilder result = new StringBuilder(pattern.length());
boolean escaped = false;
for (int i = 0, len = pattern.length(); i < len; i++) {
char c = pattern.charAt(i);
if ... | [
"public",
"static",
"String",
"patternToRegex",
"(",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"return",
"\".*\"",
";",
"}",
"else",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"pattern",
".",
"lengt... | Convert a SQL search pattern into an equivalent Java Regex.
@param pattern input which may contain '%' or '_' wildcard characters, or
these characters escaped using {@code getSearchStringEscape()}.
@return replace %/_ with regex search characters, also handle escaped
characters. | [
"Convert",
"a",
"SQL",
"search",
"pattern",
"into",
"an",
"equivalent",
"Java",
"Regex",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIServiceUtils.java#L45-L74 |
123,023 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.ensureCurrentState | public static void ensureCurrentState(Service.STATE state,
Service.STATE expectedState) {
if (state != expectedState) {
throw new IllegalStateException("For this operation, the " +
"current service state must be "
... | java | public static void ensureCurrentState(Service.STATE state,
Service.STATE expectedState) {
if (state != expectedState) {
throw new IllegalStateException("For this operation, the " +
"current service state must be "
... | [
"public",
"static",
"void",
"ensureCurrentState",
"(",
"Service",
".",
"STATE",
"state",
",",
"Service",
".",
"STATE",
"expectedState",
")",
"{",
"if",
"(",
"state",
"!=",
"expectedState",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"For this opera... | Verify that a service is in a given state.
@param state the actual state a service is in
@param expectedState the desired state
@throws IllegalStateException if the service state is different from
the desired state | [
"Verify",
"that",
"a",
"service",
"is",
"in",
"a",
"given",
"state",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L42-L50 |
123,024 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.init | public static void init(Service service, HiveConf configuration) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.NOTINITED);
service.init(configuration);
} | java | public static void init(Service service, HiveConf configuration) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.NOTINITED);
service.init(configuration);
} | [
"public",
"static",
"void",
"init",
"(",
"Service",
"service",
",",
"HiveConf",
"configuration",
")",
"{",
"Service",
".",
"STATE",
"state",
"=",
"service",
".",
"getServiceState",
"(",
")",
";",
"ensureCurrentState",
"(",
"state",
",",
"Service",
".",
"STAT... | Initialize a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#NOTINITED}
@param configuration the configuration to initialize the service with
@throws RuntimeException on a state cha... | [
"Initialize",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L64-L68 |
123,025 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.start | public static void start(Service service) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.INITED);
service.start();
} | java | public static void start(Service service) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.INITED);
service.start();
} | [
"public",
"static",
"void",
"start",
"(",
"Service",
"service",
")",
"{",
"Service",
".",
"STATE",
"state",
"=",
"service",
".",
"getServiceState",
"(",
")",
";",
"ensureCurrentState",
"(",
"state",
",",
"Service",
".",
"STATE",
".",
"INITED",
")",
";",
... | Start a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#INITED}
@throws RuntimeException on a state change failure
@throws IllegalStateException if the service is in the wrong state | [
"Start",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L81-L85 |
123,026 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.deploy | public static void deploy(Service service, HiveConf configuration) {
init(service, configuration);
start(service);
} | java | public static void deploy(Service service, HiveConf configuration) {
init(service, configuration);
start(service);
} | [
"public",
"static",
"void",
"deploy",
"(",
"Service",
"service",
",",
"HiveConf",
"configuration",
")",
"{",
"init",
"(",
"service",
",",
"configuration",
")",
";",
"start",
"(",
"service",
")",
";",
"}"
] | Initialize then start a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#NOTINITED}
@param configuration the configuration to initialize the service with
@throws RuntimeException on ... | [
"Initialize",
"then",
"start",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L98-L101 |
123,027 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.stop | public static void stop(Service service) {
if (service != null) {
Service.STATE state = service.getServiceState();
if (state == Service.STATE.STARTED) {
service.stop();
}
}
} | java | public static void stop(Service service) {
if (service != null) {
Service.STATE state = service.getServiceState();
if (state == Service.STATE.STARTED) {
service.stop();
}
}
} | [
"public",
"static",
"void",
"stop",
"(",
"Service",
"service",
")",
"{",
"if",
"(",
"service",
"!=",
"null",
")",
"{",
"Service",
".",
"STATE",
"state",
"=",
"service",
".",
"getServiceState",
"(",
")",
";",
"if",
"(",
"state",
"==",
"Service",
".",
... | Stop a service.
Do nothing if the service is null or not in a state in which it can be/needs to be stopped.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service or null | [
"Stop",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L112-L119 |
123,028 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java | VectorizedColumnReader.next | private boolean next() throws IOException {
if (valuesRead >= endOfPageValueCount) {
if (valuesRead >= totalValueCount) {
// How do we get here? Throw end of stream exception?
return false;
}
readPage();
}
++valuesRead;
// TODO: Don't read for flat schemas
//repetit... | java | private boolean next() throws IOException {
if (valuesRead >= endOfPageValueCount) {
if (valuesRead >= totalValueCount) {
// How do we get here? Throw end of stream exception?
return false;
}
readPage();
}
++valuesRead;
// TODO: Don't read for flat schemas
//repetit... | [
"private",
"boolean",
"next",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"valuesRead",
">=",
"endOfPageValueCount",
")",
"{",
"if",
"(",
"valuesRead",
">=",
"totalValueCount",
")",
"{",
"// How do we get here? Throw end of stream exception?",
"return",
"false"... | Advances to the next value. Returns true if the value is non-null. | [
"Advances",
"to",
"the",
"next",
"value",
".",
"Returns",
"true",
"if",
"the",
"value",
"is",
"non",
"-",
"null",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L136-L148 |
123,029 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java | VectorizedColumnReader.readBatch | void readBatch(int total, WritableColumnVector column) throws IOException {
int rowId = 0;
WritableColumnVector dictionaryIds = null;
if (dictionary != null) {
// SPARK-16334: We only maintain a single dictionary per row batch, so that it can be used to
// decode all previous dictionary encoded ... | java | void readBatch(int total, WritableColumnVector column) throws IOException {
int rowId = 0;
WritableColumnVector dictionaryIds = null;
if (dictionary != null) {
// SPARK-16334: We only maintain a single dictionary per row batch, so that it can be used to
// decode all previous dictionary encoded ... | [
"void",
"readBatch",
"(",
"int",
"total",
",",
"WritableColumnVector",
"column",
")",
"throws",
"IOException",
"{",
"int",
"rowId",
"=",
"0",
";",
"WritableColumnVector",
"dictionaryIds",
"=",
"null",
";",
"if",
"(",
"dictionary",
"!=",
"null",
")",
"{",
"//... | Reads `total` values from this columnReader into column. | [
"Reads",
"total",
"values",
"from",
"this",
"columnReader",
"into",
"column",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L153-L235 |
123,030 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java | VectorizedColumnReader.constructConvertNotSupportedException | private SchemaColumnConvertNotSupportedException constructConvertNotSupportedException(
ColumnDescriptor descriptor,
WritableColumnVector column) {
return new SchemaColumnConvertNotSupportedException(
Arrays.toString(descriptor.getPath()),
descriptor.getPrimitiveType().getPrimitiveTypeName()... | java | private SchemaColumnConvertNotSupportedException constructConvertNotSupportedException(
ColumnDescriptor descriptor,
WritableColumnVector column) {
return new SchemaColumnConvertNotSupportedException(
Arrays.toString(descriptor.getPath()),
descriptor.getPrimitiveType().getPrimitiveTypeName()... | [
"private",
"SchemaColumnConvertNotSupportedException",
"constructConvertNotSupportedException",
"(",
"ColumnDescriptor",
"descriptor",
",",
"WritableColumnVector",
"column",
")",
"{",
"return",
"new",
"SchemaColumnConvertNotSupportedException",
"(",
"Arrays",
".",
"toString",
"("... | Helper function to construct exception for parquet schema mismatch. | [
"Helper",
"function",
"to",
"construct",
"exception",
"for",
"parquet",
"schema",
"mismatch",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L244-L251 |
123,031 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.createEventLoop | public static EventLoopGroup createEventLoop(IOMode mode, int numThreads, String threadPrefix) {
ThreadFactory threadFactory = createThreadFactory(threadPrefix);
switch (mode) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopG... | java | public static EventLoopGroup createEventLoop(IOMode mode, int numThreads, String threadPrefix) {
ThreadFactory threadFactory = createThreadFactory(threadPrefix);
switch (mode) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopG... | [
"public",
"static",
"EventLoopGroup",
"createEventLoop",
"(",
"IOMode",
"mode",
",",
"int",
"numThreads",
",",
"String",
"threadPrefix",
")",
"{",
"ThreadFactory",
"threadFactory",
"=",
"createThreadFactory",
"(",
"threadPrefix",
")",
";",
"switch",
"(",
"mode",
"... | Creates a Netty EventLoopGroup based on the IOMode. | [
"Creates",
"a",
"Netty",
"EventLoopGroup",
"based",
"on",
"the",
"IOMode",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L61-L72 |
123,032 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.getServerChannelClass | public static Class<? extends ServerChannel> getServerChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioServerSocketChannel.class;
case EPOLL:
return EpollServerSocketChannel.class;
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}... | java | public static Class<? extends ServerChannel> getServerChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioServerSocketChannel.class;
case EPOLL:
return EpollServerSocketChannel.class;
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}... | [
"public",
"static",
"Class",
"<",
"?",
"extends",
"ServerChannel",
">",
"getServerChannelClass",
"(",
"IOMode",
"mode",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"NIO",
":",
"return",
"NioServerSocketChannel",
".",
"class",
";",
"case",
"EPOLL",
":"... | Returns the correct ServerSocketChannel class based on IOMode. | [
"Returns",
"the",
"correct",
"ServerSocketChannel",
"class",
"based",
"on",
"IOMode",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L87-L96 |
123,033 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.getRemoteAddress | public static String getRemoteAddress(Channel channel) {
if (channel != null && channel.remoteAddress() != null) {
return channel.remoteAddress().toString();
}
return "<unknown remote>";
} | java | public static String getRemoteAddress(Channel channel) {
if (channel != null && channel.remoteAddress() != null) {
return channel.remoteAddress().toString();
}
return "<unknown remote>";
} | [
"public",
"static",
"String",
"getRemoteAddress",
"(",
"Channel",
"channel",
")",
"{",
"if",
"(",
"channel",
"!=",
"null",
"&&",
"channel",
".",
"remoteAddress",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"channel",
".",
"remoteAddress",
"(",
")",
".",
... | Returns the remote address on the channel or "<unknown remote>" if none exists. | [
"Returns",
"the",
"remote",
"address",
"on",
"the",
"channel",
"or",
"<",
";",
"unknown",
"remote>",
";",
"if",
"none",
"exists",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L107-L112 |
123,034 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.defaultNumThreads | public static int defaultNumThreads(int numUsableCores) {
final int availableCores;
if (numUsableCores > 0) {
availableCores = numUsableCores;
} else {
availableCores = Runtime.getRuntime().availableProcessors();
}
return Math.min(availableCores, MAX_DEFAULT_NETTY_THREADS);
} | java | public static int defaultNumThreads(int numUsableCores) {
final int availableCores;
if (numUsableCores > 0) {
availableCores = numUsableCores;
} else {
availableCores = Runtime.getRuntime().availableProcessors();
}
return Math.min(availableCores, MAX_DEFAULT_NETTY_THREADS);
} | [
"public",
"static",
"int",
"defaultNumThreads",
"(",
"int",
"numUsableCores",
")",
"{",
"final",
"int",
"availableCores",
";",
"if",
"(",
"numUsableCores",
">",
"0",
")",
"{",
"availableCores",
"=",
"numUsableCores",
";",
"}",
"else",
"{",
"availableCores",
"=... | Returns the default number of threads for both the Netty client and server thread pools.
If numUsableCores is 0, we will use Runtime get an approximate number of available cores. | [
"Returns",
"the",
"default",
"number",
"of",
"threads",
"for",
"both",
"the",
"Netty",
"client",
"and",
"server",
"thread",
"pools",
".",
"If",
"numUsableCores",
"is",
"0",
"we",
"will",
"use",
"Runtime",
"get",
"an",
"approximate",
"number",
"of",
"availabl... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L118-L126 |
123,035 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.getSharedPooledByteBufAllocator | public static synchronized PooledByteBufAllocator getSharedPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache) {
final int index = allowCache ? 0 : 1;
if (_sharedPooledByteBufAllocator[index] == null) {
_sharedPooledByteBufAllocator[index] =
createPooledByteBufAllocato... | java | public static synchronized PooledByteBufAllocator getSharedPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache) {
final int index = allowCache ? 0 : 1;
if (_sharedPooledByteBufAllocator[index] == null) {
_sharedPooledByteBufAllocator[index] =
createPooledByteBufAllocato... | [
"public",
"static",
"synchronized",
"PooledByteBufAllocator",
"getSharedPooledByteBufAllocator",
"(",
"boolean",
"allowDirectBufs",
",",
"boolean",
"allowCache",
")",
"{",
"final",
"int",
"index",
"=",
"allowCache",
"?",
"0",
":",
"1",
";",
"if",
"(",
"_sharedPooled... | Returns the lazily created shared pooled ByteBuf allocator for the specified allowCache
parameter value. | [
"Returns",
"the",
"lazily",
"created",
"shared",
"pooled",
"ByteBuf",
"allocator",
"for",
"the",
"specified",
"allowCache",
"parameter",
"value",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L132-L144 |
123,036 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.createPooledByteBufAllocator | public static PooledByteBufAllocator createPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache,
int numCores) {
if (numCores == 0) {
numCores = Runtime.getRuntime().availableProcessors();
}
return new PooledByteBufAllocator(
allowDirectBufs && PlatformDependent.... | java | public static PooledByteBufAllocator createPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache,
int numCores) {
if (numCores == 0) {
numCores = Runtime.getRuntime().availableProcessors();
}
return new PooledByteBufAllocator(
allowDirectBufs && PlatformDependent.... | [
"public",
"static",
"PooledByteBufAllocator",
"createPooledByteBufAllocator",
"(",
"boolean",
"allowDirectBufs",
",",
"boolean",
"allowCache",
",",
"int",
"numCores",
")",
"{",
"if",
"(",
"numCores",
"==",
"0",
")",
"{",
"numCores",
"=",
"Runtime",
".",
"getRuntim... | Create a pooled ByteBuf allocator but disables the thread-local cache. Thread-local caches
are disabled for TransportClients because the ByteBufs are allocated by the event loop thread,
but released by the executor thread rather than the event loop thread. Those thread-local
caches actually delay the recycling of buffe... | [
"Create",
"a",
"pooled",
"ByteBuf",
"allocator",
"but",
"disables",
"the",
"thread",
"-",
"local",
"cache",
".",
"Thread",
"-",
"local",
"caches",
"are",
"disabled",
"for",
"TransportClients",
"because",
"the",
"ByteBufs",
"are",
"allocated",
"by",
"the",
"eve... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L152-L170 |
123,037 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.createCookieToken | public static String createCookieToken(String clientUserName) {
StringBuffer sb = new StringBuffer();
sb.append(COOKIE_CLIENT_USER_NAME).append(COOKIE_KEY_VALUE_SEPARATOR).append(clientUserName)
.append(COOKIE_ATTR_SEPARATOR);
sb.append(COOKIE_CLIENT_RAND_NUMBER).append(COOKIE_KEY_VALUE_SEPARATOR)
... | java | public static String createCookieToken(String clientUserName) {
StringBuffer sb = new StringBuffer();
sb.append(COOKIE_CLIENT_USER_NAME).append(COOKIE_KEY_VALUE_SEPARATOR).append(clientUserName)
.append(COOKIE_ATTR_SEPARATOR);
sb.append(COOKIE_CLIENT_RAND_NUMBER).append(COOKIE_KEY_VALUE_SEPARATOR)
... | [
"public",
"static",
"String",
"createCookieToken",
"(",
"String",
"clientUserName",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"COOKIE_CLIENT_USER_NAME",
")",
".",
"append",
"(",
"COOKIE_KEY_VALUE_SEPARATOR... | Creates and returns a HS2 cookie token.
@param clientUserName Client User name.
@return An unsigned cookie token generated from input parameters.
The final cookie generated is of the following format :
{@code cu=<username>&rn=<randomNumber>&s=<cookieSignature>} | [
"Creates",
"and",
"returns",
"a",
"HS2",
"cookie",
"token",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L94-L101 |
123,038 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.getUserNameFromCookieToken | public static String getUserNameFromCookieToken(String tokenStr) {
Map<String, String> map = splitCookieToken(tokenStr);
if (!map.keySet().equals(COOKIE_ATTRIBUTES)) {
LOG.error("Invalid token with missing attributes " + tokenStr);
return null;
}
return map.get(COOKIE_CLIENT_USER_NAME);
} | java | public static String getUserNameFromCookieToken(String tokenStr) {
Map<String, String> map = splitCookieToken(tokenStr);
if (!map.keySet().equals(COOKIE_ATTRIBUTES)) {
LOG.error("Invalid token with missing attributes " + tokenStr);
return null;
}
return map.get(COOKIE_CLIENT_USER_NAME);
} | [
"public",
"static",
"String",
"getUserNameFromCookieToken",
"(",
"String",
"tokenStr",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"splitCookieToken",
"(",
"tokenStr",
")",
";",
"if",
"(",
"!",
"map",
".",
"keySet",
"(",
")",
".",
"eq... | Parses a cookie token to retrieve client user name.
@param tokenStr Token String.
@return A valid user name if input is of valid format, else returns null. | [
"Parses",
"a",
"cookie",
"token",
"to",
"retrieve",
"client",
"user",
"name",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L108-L116 |
123,039 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.splitCookieToken | private static Map<String, String> splitCookieToken(String tokenStr) {
Map<String, String> map = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR);
while (st.hasMoreTokens()) {
String part = st.nextToken();
int separator = part.indexOf(COOK... | java | private static Map<String, String> splitCookieToken(String tokenStr) {
Map<String, String> map = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR);
while (st.hasMoreTokens()) {
String part = st.nextToken();
int separator = part.indexOf(COOK... | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"splitCookieToken",
"(",
"String",
"tokenStr",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"StringTok... | Splits the cookie token into attributes pairs.
@param str input token.
@return a map with the attribute pairs of the token if the input is valid.
Else, returns null. | [
"Splits",
"the",
"cookie",
"token",
"into",
"attributes",
"pairs",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L124-L140 |
123,040 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/Operation.java | Operation.validateFetchOrientation | protected void validateFetchOrientation(FetchOrientation orientation,
EnumSet<FetchOrientation> supportedOrientations) throws HiveSQLException {
if (!supportedOrientations.contains(orientation)) {
throw new HiveSQLException("The fetch type " + orientation.toString() +
" is not supported for th... | java | protected void validateFetchOrientation(FetchOrientation orientation,
EnumSet<FetchOrientation> supportedOrientations) throws HiveSQLException {
if (!supportedOrientations.contains(orientation)) {
throw new HiveSQLException("The fetch type " + orientation.toString() +
" is not supported for th... | [
"protected",
"void",
"validateFetchOrientation",
"(",
"FetchOrientation",
"orientation",
",",
"EnumSet",
"<",
"FetchOrientation",
">",
"supportedOrientations",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"!",
"supportedOrientations",
".",
"contains",
"(",
"orient... | Verify if the given fetch orientation is part of the supported orientation types.
@param orientation
@param supportedOrientations
@throws HiveSQLException | [
"Verify",
"if",
"the",
"given",
"fetch",
"orientation",
"is",
"part",
"of",
"the",
"supported",
"orientation",
"types",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/Operation.java#L306-L312 |
123,041 | apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java | Platform.allocateDirectBuffer | public static ByteBuffer allocateDirectBuffer(int size) {
try {
if (CLEANER_CREATE_METHOD == null) {
// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs
try {
return ByteBuffer.allocateDirect(size);
} catch (OutOfMemoryError oome) {
... | java | public static ByteBuffer allocateDirectBuffer(int size) {
try {
if (CLEANER_CREATE_METHOD == null) {
// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs
try {
return ByteBuffer.allocateDirect(size);
} catch (OutOfMemoryError oome) {
... | [
"public",
"static",
"ByteBuffer",
"allocateDirectBuffer",
"(",
"int",
"size",
")",
"{",
"try",
"{",
"if",
"(",
"CLEANER_CREATE_METHOD",
"==",
"null",
")",
"{",
"// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs",
"try",
"{",
"return",
... | Allocate a DirectByteBuffer, potentially bypassing the JVM's MaxDirectMemorySize limit. | [
"Allocate",
"a",
"DirectByteBuffer",
"potentially",
"bypassing",
"the",
"JVM",
"s",
"MaxDirectMemorySize",
"limit",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java#L214-L244 |
123,042 | apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/ByteArray.java | ByteArray.writeToMemory | public static void writeToMemory(byte[] src, Object target, long targetOffset) {
Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET, target, targetOffset, src.length);
} | java | public static void writeToMemory(byte[] src, Object target, long targetOffset) {
Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET, target, targetOffset, src.length);
} | [
"public",
"static",
"void",
"writeToMemory",
"(",
"byte",
"[",
"]",
"src",
",",
"Object",
"target",
",",
"long",
"targetOffset",
")",
"{",
"Platform",
".",
"copyMemory",
"(",
"src",
",",
"Platform",
".",
"BYTE_ARRAY_OFFSET",
",",
"target",
",",
"targetOffset... | Writes the content of a byte array into a memory address, identified by an object and an
offset. The target memory address must already been allocated, and have enough space to
hold all the bytes in this string. | [
"Writes",
"the",
"content",
"of",
"a",
"byte",
"array",
"into",
"a",
"memory",
"address",
"identified",
"by",
"an",
"object",
"and",
"an",
"offset",
".",
"The",
"target",
"memory",
"address",
"must",
"already",
"been",
"allocated",
"and",
"have",
"enough",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/ByteArray.java#L35-L37 |
123,043 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java | OffHeapColumnVector.allocateColumns | public static OffHeapColumnVector[] allocateColumns(int capacity, StructField[] fields) {
OffHeapColumnVector[] vectors = new OffHeapColumnVector[fields.length];
for (int i = 0; i < fields.length; i++) {
vectors[i] = new OffHeapColumnVector(capacity, fields[i].dataType());
}
return vectors;
} | java | public static OffHeapColumnVector[] allocateColumns(int capacity, StructField[] fields) {
OffHeapColumnVector[] vectors = new OffHeapColumnVector[fields.length];
for (int i = 0; i < fields.length; i++) {
vectors[i] = new OffHeapColumnVector(capacity, fields[i].dataType());
}
return vectors;
} | [
"public",
"static",
"OffHeapColumnVector",
"[",
"]",
"allocateColumns",
"(",
"int",
"capacity",
",",
"StructField",
"[",
"]",
"fields",
")",
"{",
"OffHeapColumnVector",
"[",
"]",
"vectors",
"=",
"new",
"OffHeapColumnVector",
"[",
"fields",
".",
"length",
"]",
... | Allocates columns to store elements of each field off heap.
Capacity is the initial capacity of the vector and it will grow as necessary. Capacity is
in number of elements, not number of bytes. | [
"Allocates",
"columns",
"to",
"store",
"elements",
"of",
"each",
"field",
"off",
"heap",
".",
"Capacity",
"is",
"the",
"initial",
"capacity",
"of",
"the",
"vector",
"and",
"it",
"will",
"grow",
"as",
"necessary",
".",
"Capacity",
"is",
"in",
"number",
"of"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java#L50-L56 |
123,044 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java | OffHeapColumnVector.putByteArray | @Override
public int putByteArray(int rowId, byte[] value, int offset, int length) {
int result = arrayData().appendBytes(length, value, offset);
Platform.putInt(null, lengthData + 4L * rowId, length);
Platform.putInt(null, offsetData + 4L * rowId, result);
return result;
} | java | @Override
public int putByteArray(int rowId, byte[] value, int offset, int length) {
int result = arrayData().appendBytes(length, value, offset);
Platform.putInt(null, lengthData + 4L * rowId, length);
Platform.putInt(null, offsetData + 4L * rowId, result);
return result;
} | [
"@",
"Override",
"public",
"int",
"putByteArray",
"(",
"int",
"rowId",
",",
"byte",
"[",
"]",
"value",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"result",
"=",
"arrayData",
"(",
")",
".",
"appendBytes",
"(",
"length",
",",
"value",
... | APIs dealing with ByteArrays | [
"APIs",
"dealing",
"with",
"ByteArrays"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java#L521-L527 |
123,045 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java | OffHeapColumnVector.reserveInternal | @Override
protected void reserveInternal(int newCapacity) {
int oldCapacity = (nulls == 0L) ? 0 : capacity;
if (isArray() || type instanceof MapType) {
this.lengthData =
Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity * 4L);
this.offsetData =
Platform.reallo... | java | @Override
protected void reserveInternal(int newCapacity) {
int oldCapacity = (nulls == 0L) ? 0 : capacity;
if (isArray() || type instanceof MapType) {
this.lengthData =
Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity * 4L);
this.offsetData =
Platform.reallo... | [
"@",
"Override",
"protected",
"void",
"reserveInternal",
"(",
"int",
"newCapacity",
")",
"{",
"int",
"oldCapacity",
"=",
"(",
"nulls",
"==",
"0L",
")",
"?",
"0",
":",
"capacity",
";",
"if",
"(",
"isArray",
"(",
")",
"||",
"type",
"instanceof",
"MapType",... | Split out the slow path. | [
"Split",
"out",
"the",
"slow",
"path",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java#L530-L556 |
123,046 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.init | private void init(int bitWidth) {
Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth);
this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
} | java | private void init(int bitWidth) {
Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth);
this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
} | [
"private",
"void",
"init",
"(",
"int",
"bitWidth",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"bitWidth",
">=",
"0",
"&&",
"bitWidth",
"<=",
"32",
",",
"\"bitWidth must be >= 0 and <= 32\"",
")",
";",
"this",
".",
"bitWidth",
"=",
"bitWidth",
";",
... | Initializes the internal state for decoding ints of `bitWidth`. | [
"Initializes",
"the",
"internal",
"state",
"for",
"decoding",
"ints",
"of",
"bitWidth",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L122-L127 |
123,047 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.readIntegers | @Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE:
c.putInts(rowId, n, currentValue);
... | java | @Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE:
c.putInts(rowId, n, currentValue);
... | [
"@",
"Override",
"public",
"void",
"readIntegers",
"(",
"int",
"total",
",",
"WritableColumnVector",
"c",
",",
"int",
"rowId",
")",
"{",
"int",
"left",
"=",
"total",
";",
"while",
"(",
"left",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"currentCount",... | Since this is only used to decode dictionary IDs, only decoding integers is supported. | [
"Since",
"this",
"is",
"only",
"used",
"to",
"decode",
"dictionary",
"IDs",
"only",
"decoding",
"integers",
"is",
"supported",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L490-L509 |
123,048 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.readUnsignedVarInt | private int readUnsignedVarInt() throws IOException {
int value = 0;
int shift = 0;
int b;
do {
b = in.read();
value |= (b & 0x7F) << shift;
shift += 7;
} while ((b & 0x80) != 0);
return value;
} | java | private int readUnsignedVarInt() throws IOException {
int value = 0;
int shift = 0;
int b;
do {
b = in.read();
value |= (b & 0x7F) << shift;
shift += 7;
} while ((b & 0x80) != 0);
return value;
} | [
"private",
"int",
"readUnsignedVarInt",
"(",
")",
"throws",
"IOException",
"{",
"int",
"value",
"=",
"0",
";",
"int",
"shift",
"=",
"0",
";",
"int",
"b",
";",
"do",
"{",
"b",
"=",
"in",
".",
"read",
"(",
")",
";",
"value",
"|=",
"(",
"b",
"&",
... | Reads the next varint encoded int. | [
"Reads",
"the",
"next",
"varint",
"encoded",
"int",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L554-L564 |
123,049 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.readIntLittleEndianPaddedOnBitWidth | private int readIntLittleEndianPaddedOnBitWidth() throws IOException {
switch (bytesWidth) {
case 0:
return 0;
case 1:
return in.read();
case 2: {
int ch2 = in.read();
int ch1 = in.read();
return (ch1 << 8) + ch2;
}
case 3: {
int ch3 = in... | java | private int readIntLittleEndianPaddedOnBitWidth() throws IOException {
switch (bytesWidth) {
case 0:
return 0;
case 1:
return in.read();
case 2: {
int ch2 = in.read();
int ch1 = in.read();
return (ch1 << 8) + ch2;
}
case 3: {
int ch3 = in... | [
"private",
"int",
"readIntLittleEndianPaddedOnBitWidth",
"(",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"bytesWidth",
")",
"{",
"case",
"0",
":",
"return",
"0",
";",
"case",
"1",
":",
"return",
"in",
".",
"read",
"(",
")",
";",
"case",
"2",
":",
... | Reads the next byteWidth little endian int. | [
"Reads",
"the",
"next",
"byteWidth",
"little",
"endian",
"int",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L580-L602 |
123,050 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.readNextGroup | private void readNextGroup() {
try {
int header = readUnsignedVarInt();
this.mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE:
this.currentCount = header >>> 1;
this.currentValue = readIntLittleEndianPaddedOnBitWidth();
return;
... | java | private void readNextGroup() {
try {
int header = readUnsignedVarInt();
this.mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE:
this.currentCount = header >>> 1;
this.currentValue = readIntLittleEndianPaddedOnBitWidth();
return;
... | [
"private",
"void",
"readNextGroup",
"(",
")",
"{",
"try",
"{",
"int",
"header",
"=",
"readUnsignedVarInt",
"(",
")",
";",
"this",
".",
"mode",
"=",
"(",
"header",
"&",
"1",
")",
"==",
"0",
"?",
"MODE",
".",
"RLE",
":",
"MODE",
".",
"PACKED",
";",
... | Reads the next group. | [
"Reads",
"the",
"next",
"group",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L611-L642 |
123,051 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java | AbstractService.changeState | private void changeState(Service.STATE newState) {
state = newState;
// notify listeners
for (ServiceStateChangeListener l : listeners) {
l.stateChanged(this);
}
} | java | private void changeState(Service.STATE newState) {
state = newState;
// notify listeners
for (ServiceStateChangeListener l : listeners) {
l.stateChanged(this);
}
} | [
"private",
"void",
"changeState",
"(",
"Service",
".",
"STATE",
"newState",
")",
"{",
"state",
"=",
"newState",
";",
"// notify listeners",
"for",
"(",
"ServiceStateChangeListener",
"l",
":",
"listeners",
")",
"{",
"l",
".",
"stateChanged",
"(",
"this",
")",
... | Change to a new state and notify all listeners.
This is a private method that is only invoked from synchronized methods,
which avoid having to clone the listener list. It does imply that
the state change listener methods should be short lived, as they
will delay the state transition.
@param newState
new service state | [
"Change",
"to",
"a",
"new",
"state",
"and",
"notify",
"all",
"listeners",
".",
"This",
"is",
"a",
"private",
"method",
"that",
"is",
"only",
"invoked",
"from",
"synchronized",
"methods",
"which",
"avoid",
"having",
"to",
"clone",
"the",
"listener",
"list",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java#L176-L182 |
123,052 | apache/spark | core/src/main/java/org/apache/spark/memory/MemoryConsumer.java | MemoryConsumer.allocateArray | public LongArray allocateArray(long size) {
long required = size * 8L;
MemoryBlock page = taskMemoryManager.allocatePage(required, this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += required;
return new LongArray(page);
} | java | public LongArray allocateArray(long size) {
long required = size * 8L;
MemoryBlock page = taskMemoryManager.allocatePage(required, this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += required;
return new LongArray(page);
} | [
"public",
"LongArray",
"allocateArray",
"(",
"long",
"size",
")",
"{",
"long",
"required",
"=",
"size",
"*",
"8L",
";",
"MemoryBlock",
"page",
"=",
"taskMemoryManager",
".",
"allocatePage",
"(",
"required",
",",
"this",
")",
";",
"if",
"(",
"page",
"==",
... | Allocates a LongArray of `size`. Note that this method may throw `SparkOutOfMemoryError`
if Spark doesn't have enough memory for this allocation, or throw `TooLargePageException`
if this `LongArray` is too large to fit in a single page. The caller side should take care of
these two exceptions, or make sure the `size` i... | [
"Allocates",
"a",
"LongArray",
"of",
"size",
".",
"Note",
"that",
"this",
"method",
"may",
"throw",
"SparkOutOfMemoryError",
"if",
"Spark",
"doesn",
"t",
"have",
"enough",
"memory",
"for",
"this",
"allocation",
"or",
"throw",
"TooLargePageException",
"if",
"this... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/MemoryConsumer.java#L94-L102 |
123,053 | apache/spark | core/src/main/java/org/apache/spark/memory/MemoryConsumer.java | MemoryConsumer.allocatePage | protected MemoryBlock allocatePage(long required) {
MemoryBlock page = taskMemoryManager.allocatePage(Math.max(pageSize, required), this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += page.size();
return page;
} | java | protected MemoryBlock allocatePage(long required) {
MemoryBlock page = taskMemoryManager.allocatePage(Math.max(pageSize, required), this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += page.size();
return page;
} | [
"protected",
"MemoryBlock",
"allocatePage",
"(",
"long",
"required",
")",
"{",
"MemoryBlock",
"page",
"=",
"taskMemoryManager",
".",
"allocatePage",
"(",
"Math",
".",
"max",
"(",
"pageSize",
",",
"required",
")",
",",
"this",
")",
";",
"if",
"(",
"page",
"... | Allocate a memory block with at least `required` bytes.
@throws SparkOutOfMemoryError | [
"Allocate",
"a",
"memory",
"block",
"with",
"at",
"least",
"required",
"bytes",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/MemoryConsumer.java#L116-L123 |
123,054 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/protocol/MessageWithHeader.java | MessageWithHeader.transferTo | @Override
public long transferTo(final WritableByteChannel target, final long position) throws IOException {
Preconditions.checkArgument(position == totalBytesTransferred, "Invalid position.");
// Bytes written for header in this call.
long writtenHeader = 0;
if (header.readableBytes() > 0) {
wr... | java | @Override
public long transferTo(final WritableByteChannel target, final long position) throws IOException {
Preconditions.checkArgument(position == totalBytesTransferred, "Invalid position.");
// Bytes written for header in this call.
long writtenHeader = 0;
if (header.readableBytes() > 0) {
wr... | [
"@",
"Override",
"public",
"long",
"transferTo",
"(",
"final",
"WritableByteChannel",
"target",
",",
"final",
"long",
"position",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"position",
"==",
"totalBytesTransferred",
",",
"\"Invali... | This code is more complicated than you would think because we might require multiple
transferTo invocations in order to transfer a single MessageWithHeader to avoid busy waiting.
The contract is that the caller will ensure position is properly set to the total number
of bytes transferred so far (i.e. value returned by... | [
"This",
"code",
"is",
"more",
"complicated",
"than",
"you",
"would",
"think",
"because",
"we",
"might",
"require",
"multiple",
"transferTo",
"invocations",
"in",
"order",
"to",
"transfer",
"a",
"single",
"MessageWithHeader",
"to",
"avoid",
"busy",
"waiting",
"."... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/protocol/MessageWithHeader.java#L105-L128 |
123,055 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.pointTo | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
assert numFields >= 0 : "numFields (" + numFields + ") should >= 0";
assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8";
this.baseObject = baseObject;
this.baseOffset = baseOffset;
thi... | java | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
assert numFields >= 0 : "numFields (" + numFields + ") should >= 0";
assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8";
this.baseObject = baseObject;
this.baseOffset = baseOffset;
thi... | [
"public",
"void",
"pointTo",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"int",
"sizeInBytes",
")",
"{",
"assert",
"numFields",
">=",
"0",
":",
"\"numFields (\"",
"+",
"numFields",
"+",
"\") should >= 0\"",
";",
"assert",
"sizeInBytes",
"%",
"... | Update this UnsafeRow to point to different backing data.
@param baseObject the base object
@param baseOffset the offset within the base object
@param sizeInBytes the size of this row's backing data, in bytes | [
"Update",
"this",
"UnsafeRow",
"to",
"point",
"to",
"different",
"backing",
"data",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L166-L172 |
123,056 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.setDecimal | @Override
public void setDecimal(int ordinal, Decimal value, int precision) {
assertIndexIsValid(ordinal);
if (precision <= Decimal.MAX_LONG_DIGITS()) {
// compact format
if (value == null) {
setNullAt(ordinal);
} else {
setLong(ordinal, value.toUnscaledLong());
}
}... | java | @Override
public void setDecimal(int ordinal, Decimal value, int precision) {
assertIndexIsValid(ordinal);
if (precision <= Decimal.MAX_LONG_DIGITS()) {
// compact format
if (value == null) {
setNullAt(ordinal);
} else {
setLong(ordinal, value.toUnscaledLong());
}
}... | [
"@",
"Override",
"public",
"void",
"setDecimal",
"(",
"int",
"ordinal",
",",
"Decimal",
"value",
",",
"int",
"precision",
")",
"{",
"assertIndexIsValid",
"(",
"ordinal",
")",
";",
"if",
"(",
"precision",
"<=",
"Decimal",
".",
"MAX_LONG_DIGITS",
"(",
")",
"... | Updates the decimal column.
Note: In order to support update a decimal with precision > 18, CAN NOT call
setNullAt() for this column. | [
"Updates",
"the",
"decimal",
"column",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L264-L298 |
123,057 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.copy | @Override
public UnsafeRow copy() {
UnsafeRow rowCopy = new UnsafeRow(numFields);
final byte[] rowDataCopy = new byte[sizeInBytes];
Platform.copyMemory(
baseObject,
baseOffset,
rowDataCopy,
Platform.BYTE_ARRAY_OFFSET,
sizeInBytes
);
rowCopy.pointTo(rowDataCopy, Platfo... | java | @Override
public UnsafeRow copy() {
UnsafeRow rowCopy = new UnsafeRow(numFields);
final byte[] rowDataCopy = new byte[sizeInBytes];
Platform.copyMemory(
baseObject,
baseOffset,
rowDataCopy,
Platform.BYTE_ARRAY_OFFSET,
sizeInBytes
);
rowCopy.pointTo(rowDataCopy, Platfo... | [
"@",
"Override",
"public",
"UnsafeRow",
"copy",
"(",
")",
"{",
"UnsafeRow",
"rowCopy",
"=",
"new",
"UnsafeRow",
"(",
"numFields",
")",
";",
"final",
"byte",
"[",
"]",
"rowDataCopy",
"=",
"new",
"byte",
"[",
"sizeInBytes",
"]",
";",
"Platform",
".",
"copy... | Copies this row, returning a self-contained UnsafeRow that stores its data in an internal
byte array rather than referencing data stored in a data page. | [
"Copies",
"this",
"row",
"returning",
"a",
"self",
"-",
"contained",
"UnsafeRow",
"that",
"stores",
"its",
"data",
"in",
"an",
"internal",
"byte",
"array",
"rather",
"than",
"referencing",
"data",
"stored",
"in",
"a",
"data",
"page",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L456-L469 |
123,058 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.createFromByteArray | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | java | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | [
"public",
"static",
"UnsafeRow",
"createFromByteArray",
"(",
"int",
"numBytes",
",",
"int",
"numFields",
")",
"{",
"final",
"UnsafeRow",
"row",
"=",
"new",
"UnsafeRow",
"(",
"numFields",
")",
";",
"row",
".",
"pointTo",
"(",
"new",
"byte",
"[",
"numBytes",
... | Creates an empty UnsafeRow from a byte array with specified numBytes and numFields.
The returned row is invalid until we call copyFrom on it. | [
"Creates",
"an",
"empty",
"UnsafeRow",
"from",
"a",
"byte",
"array",
"with",
"specified",
"numBytes",
"and",
"numFields",
".",
"The",
"returned",
"row",
"is",
"invalid",
"until",
"we",
"call",
"copyFrom",
"on",
"it",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L475-L479 |
123,059 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.writeToStream | public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException {
if (baseObject instanceof byte[]) {
int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET);
out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes);
} | java | public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException {
if (baseObject instanceof byte[]) {
int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET);
out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes);
} | [
"public",
"void",
"writeToStream",
"(",
"OutputStream",
"out",
",",
"byte",
"[",
"]",
"writeBuffer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"baseObject",
"instanceof",
"byte",
"[",
"]",
")",
"{",
"int",
"offsetInByteArray",
"=",
"(",
"int",
")",
"("... | Write this UnsafeRow's underlying bytes to the given OutputStream.
@param out the stream to write to.
@param writeBuffer a byte array for buffering chunks of off-heap data while writing to the
output stream. If this row is backed by an on-heap byte array, then this
buffer will not be used and may be null. | [
"Write",
"this",
"UnsafeRow",
"s",
"underlying",
"bytes",
"to",
"the",
"given",
"OutputStream",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L506-L510 |
123,060 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java | SaslClientBootstrap.doBootstrap | @Override
public void doBootstrap(TransportClient client, Channel channel) {
SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption());
try {
byte[] payload = saslClient.firstToken();
while (!saslClient.isComplete()) {
SaslMessage msg = new SaslMessag... | java | @Override
public void doBootstrap(TransportClient client, Channel channel) {
SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption());
try {
byte[] payload = saslClient.firstToken();
while (!saslClient.isComplete()) {
SaslMessage msg = new SaslMessag... | [
"@",
"Override",
"public",
"void",
"doBootstrap",
"(",
"TransportClient",
"client",
",",
"Channel",
"channel",
")",
"{",
"SparkSaslClient",
"saslClient",
"=",
"new",
"SparkSaslClient",
"(",
"appId",
",",
"secretKeyHolder",
",",
"conf",
".",
"saslEncryption",
"(",
... | Performs SASL authentication by sending a token, and then proceeding with the SASL
challenge-response tokens until we either successfully authenticate or throw an exception
due to mismatch. | [
"Performs",
"SASL",
"authentication",
"by",
"sending",
"a",
"token",
"and",
"then",
"proceeding",
"with",
"the",
"SASL",
"challenge",
"-",
"response",
"tokens",
"until",
"we",
"either",
"successfully",
"authenticate",
"or",
"throw",
"an",
"exception",
"due",
"to... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java#L58-L98 |
123,061 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java | ThriftCLIService.getSessionHandle | SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res)
throws HiveSQLException, LoginException, IOException {
String userName = getUserName(req);
String ipAddress = getIpAddress();
TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
req.getClient_protocol())... | java | SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res)
throws HiveSQLException, LoginException, IOException {
String userName = getUserName(req);
String ipAddress = getIpAddress();
TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
req.getClient_protocol())... | [
"SessionHandle",
"getSessionHandle",
"(",
"TOpenSessionReq",
"req",
",",
"TOpenSessionResp",
"res",
")",
"throws",
"HiveSQLException",
",",
"LoginException",
",",
"IOException",
"{",
"String",
"userName",
"=",
"getUserName",
"(",
"req",
")",
";",
"String",
"ipAddres... | Create a session handle
@param req
@param res
@return
@throws HiveSQLException
@throws LoginException
@throws IOException | [
"Create",
"a",
"session",
"handle"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L341-L359 |
123,062 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java | ThriftCLIService.getProxyUser | private String getProxyUser(String realUser, Map<String, String> sessionConf,
String ipAddress) throws HiveSQLException {
String proxyUser = null;
// Http transport mode.
// We set the thread local proxy username, in ThriftHttpServlet.
if (cliService.getHiveConf().getVar(
ConfVars.HIVE_SER... | java | private String getProxyUser(String realUser, Map<String, String> sessionConf,
String ipAddress) throws HiveSQLException {
String proxyUser = null;
// Http transport mode.
// We set the thread local proxy username, in ThriftHttpServlet.
if (cliService.getHiveConf().getVar(
ConfVars.HIVE_SER... | [
"private",
"String",
"getProxyUser",
"(",
"String",
"realUser",
",",
"Map",
"<",
"String",
",",
"String",
">",
"sessionConf",
",",
"String",
"ipAddress",
")",
"throws",
"HiveSQLException",
"{",
"String",
"proxyUser",
"=",
"null",
";",
"// Http transport mode.",
... | If the proxy user name is provided then check privileges to substitute the user.
@param realUser
@param sessionConf
@param ipAddress
@return
@throws HiveSQLException | [
"If",
"the",
"proxy",
"user",
"name",
"is",
"provided",
"then",
"check",
"privileges",
"to",
"substitute",
"the",
"user",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L647-L683 |
123,063 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java | CaseInsensitiveStringMap.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.
if (value == null) {
return defaultValue;
} else if (value.equalsIgnoreCase("true")) {
return true;
} else if (valu... | java | public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.
if (value == null) {
return defaultValue;
} else if (value.equalsIgnoreCase("true")) {
return true;
} else if (valu... | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.",
"if",
"(",
"value",
"==",
"... | Returns the boolean value to which the specified key is mapped,
or defaultValue if there is no mapping for the key. The key match is case-insensitive. | [
"Returns",
"the",
"boolean",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"defaultValue",
"if",
"there",
"is",
"no",
"mapping",
"for",
"the",
"key",
".",
"The",
"key",
"match",
"is",
"case",
"-",
"insensitive",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java#L134-L146 |
123,064 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java | CaseInsensitiveStringMap.getDouble | public double getDouble(String key, double defaultValue) {
String value = get(key);
return value == null ? defaultValue : Double.parseDouble(value);
} | java | public double getDouble(String key, double defaultValue) {
String value = get(key);
return value == null ? defaultValue : Double.parseDouble(value);
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"return",
"value",
"==",
"null",
"?",
"defaultValue",
":",
"Double",
".",
"parseDouble",
"(",
"value",
")... | Returns the double value to which the specified key is mapped,
or defaultValue if there is no mapping for the key. The key match is case-insensitive. | [
"Returns",
"the",
"double",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"defaultValue",
"if",
"there",
"is",
"no",
"mapping",
"for",
"the",
"key",
".",
"The",
"key",
"match",
"is",
"case",
"-",
"insensitive",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java#L170-L173 |
123,065 | apache/spark | common/sketch/src/main/java/org/apache/spark/util/sketch/BitArray.java | BitArray.set | boolean set(long index) {
if (!get(index)) {
data[(int) (index >>> 6)] |= (1L << index);
bitCount++;
return true;
}
return false;
} | java | boolean set(long index) {
if (!get(index)) {
data[(int) (index >>> 6)] |= (1L << index);
bitCount++;
return true;
}
return false;
} | [
"boolean",
"set",
"(",
"long",
"index",
")",
"{",
"if",
"(",
"!",
"get",
"(",
"index",
")",
")",
"{",
"data",
"[",
"(",
"int",
")",
"(",
"index",
">>>",
"6",
")",
"]",
"|=",
"(",
"1L",
"<<",
"index",
")",
";",
"bitCount",
"++",
";",
"return",... | Returns true if the bit changed value. | [
"Returns",
"true",
"if",
"the",
"bit",
"changed",
"value",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/sketch/src/main/java/org/apache/spark/util/sketch/BitArray.java#L54-L61 |
123,066 | apache/spark | common/sketch/src/main/java/org/apache/spark/util/sketch/BitArray.java | BitArray.putAll | void putAll(BitArray array) {
assert data.length == array.data.length : "BitArrays must be of equal length when merging";
long bitCount = 0;
for (int i = 0; i < data.length; i++) {
data[i] |= array.data[i];
bitCount += Long.bitCount(data[i]);
}
this.bitCount = bitCount;
} | java | void putAll(BitArray array) {
assert data.length == array.data.length : "BitArrays must be of equal length when merging";
long bitCount = 0;
for (int i = 0; i < data.length; i++) {
data[i] |= array.data[i];
bitCount += Long.bitCount(data[i]);
}
this.bitCount = bitCount;
} | [
"void",
"putAll",
"(",
"BitArray",
"array",
")",
"{",
"assert",
"data",
".",
"length",
"==",
"array",
".",
"data",
".",
"length",
":",
"\"BitArrays must be of equal length when merging\"",
";",
"long",
"bitCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
... | Combines the two BitArrays using bitwise OR. | [
"Combines",
"the",
"two",
"BitArrays",
"using",
"bitwise",
"OR",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/sketch/src/main/java/org/apache/spark/util/sketch/BitArray.java#L78-L86 |
123,067 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SaslServerBootstrap.java | SaslServerBootstrap.doBootstrap | public RpcHandler doBootstrap(Channel channel, RpcHandler rpcHandler) {
return new SaslRpcHandler(conf, channel, rpcHandler, secretKeyHolder);
} | java | public RpcHandler doBootstrap(Channel channel, RpcHandler rpcHandler) {
return new SaslRpcHandler(conf, channel, rpcHandler, secretKeyHolder);
} | [
"public",
"RpcHandler",
"doBootstrap",
"(",
"Channel",
"channel",
",",
"RpcHandler",
"rpcHandler",
")",
"{",
"return",
"new",
"SaslRpcHandler",
"(",
"conf",
",",
"channel",
",",
"rpcHandler",
",",
"secretKeyHolder",
")",
";",
"}"
] | Wrap the given application handler in a SaslRpcHandler that will handle the initial SASL
negotiation. | [
"Wrap",
"the",
"given",
"application",
"handler",
"in",
"a",
"SaslRpcHandler",
"that",
"will",
"handle",
"the",
"initial",
"SASL",
"negotiation",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslServerBootstrap.java#L45-L47 |
123,068 | apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ShuffleIndexInformation.java | ShuffleIndexInformation.getIndex | public ShuffleIndexRecord getIndex(int reduceId) {
long offset = offsets.get(reduceId);
long nextOffset = offsets.get(reduceId + 1);
return new ShuffleIndexRecord(offset, nextOffset - offset);
} | java | public ShuffleIndexRecord getIndex(int reduceId) {
long offset = offsets.get(reduceId);
long nextOffset = offsets.get(reduceId + 1);
return new ShuffleIndexRecord(offset, nextOffset - offset);
} | [
"public",
"ShuffleIndexRecord",
"getIndex",
"(",
"int",
"reduceId",
")",
"{",
"long",
"offset",
"=",
"offsets",
".",
"get",
"(",
"reduceId",
")",
";",
"long",
"nextOffset",
"=",
"offsets",
".",
"get",
"(",
"reduceId",
"+",
"1",
")",
";",
"return",
"new",... | Get index offset for a particular reducer. | [
"Get",
"index",
"offset",
"for",
"a",
"particular",
"reducer",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ShuffleIndexInformation.java#L56-L60 |
123,069 | apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UTF8StringBuilder.java | UTF8StringBuilder.grow | private void grow(int neededSize) {
if (neededSize > ARRAY_MAX - totalSize()) {
throw new UnsupportedOperationException(
"Cannot grow internal buffer by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize(... | java | private void grow(int neededSize) {
if (neededSize > ARRAY_MAX - totalSize()) {
throw new UnsupportedOperationException(
"Cannot grow internal buffer by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize(... | [
"private",
"void",
"grow",
"(",
"int",
"neededSize",
")",
"{",
"if",
"(",
"neededSize",
">",
"ARRAY_MAX",
"-",
"totalSize",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot grow internal buffer by size \"",
"+",
"neededSize",
"+"... | Grows the buffer by at least `neededSize` | [
"Grows",
"the",
"buffer",
"by",
"at",
"least",
"neededSize"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UTF8StringBuilder.java#L41-L59 |
123,070 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/TransportConf.java | TransportConf.connectionTimeoutMs | public int connectionTimeoutMs() {
long defaultNetworkTimeoutS = JavaUtils.timeStringAsSec(
conf.get("spark.network.timeout", "120s"));
long defaultTimeoutMs = JavaUtils.timeStringAsSec(
conf.get(SPARK_NETWORK_IO_CONNECTIONTIMEOUT_KEY, defaultNetworkTimeoutS + "s")) * 1000;
return (int) defaultT... | java | public int connectionTimeoutMs() {
long defaultNetworkTimeoutS = JavaUtils.timeStringAsSec(
conf.get("spark.network.timeout", "120s"));
long defaultTimeoutMs = JavaUtils.timeStringAsSec(
conf.get(SPARK_NETWORK_IO_CONNECTIONTIMEOUT_KEY, defaultNetworkTimeoutS + "s")) * 1000;
return (int) defaultT... | [
"public",
"int",
"connectionTimeoutMs",
"(",
")",
"{",
"long",
"defaultNetworkTimeoutS",
"=",
"JavaUtils",
".",
"timeStringAsSec",
"(",
"conf",
".",
"get",
"(",
"\"spark.network.timeout\"",
",",
"\"120s\"",
")",
")",
";",
"long",
"defaultTimeoutMs",
"=",
"JavaUtil... | Connect timeout in milliseconds. Default 120 secs. | [
"Connect",
"timeout",
"in",
"milliseconds",
".",
"Default",
"120",
"secs",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/TransportConf.java#L98-L104 |
123,071 | apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java | AbstractCommandBuilder.buildJavaCommand | List<String> buildJavaCommand(String extraClassPath) throws IOException {
List<String> cmd = new ArrayList<>();
String[] candidateJavaHomes = new String[] {
javaHome,
childEnv.get("JAVA_HOME"),
System.getenv("JAVA_HOME"),
System.getProperty("java.home")
};
for (String javaHome :... | java | List<String> buildJavaCommand(String extraClassPath) throws IOException {
List<String> cmd = new ArrayList<>();
String[] candidateJavaHomes = new String[] {
javaHome,
childEnv.get("JAVA_HOME"),
System.getenv("JAVA_HOME"),
System.getProperty("java.home")
};
for (String javaHome :... | [
"List",
"<",
"String",
">",
"buildJavaCommand",
"(",
"String",
"extraClassPath",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"cmd",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"candidateJavaHomes",
"=",
"new",
"Stri... | Builds a list of arguments to run java.
This method finds the java executable to use and appends JVM-specific options for running a
class with Spark in the classpath. It also loads options from the "java-opts" file in the
configuration directory being used.
Callers should still add at least the class to run, as well ... | [
"Builds",
"a",
"list",
"of",
"arguments",
"to",
"run",
"java",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java#L92-L123 |
123,072 | apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java | AbstractCommandBuilder.addToClassPath | private void addToClassPath(Set<String> cp, String entries) {
if (isEmpty(entries)) {
return;
}
String[] split = entries.split(Pattern.quote(File.pathSeparator));
for (String entry : split) {
if (!isEmpty(entry)) {
if (new File(entry).isDirectory() && !entry.endsWith(File.separator))... | java | private void addToClassPath(Set<String> cp, String entries) {
if (isEmpty(entries)) {
return;
}
String[] split = entries.split(Pattern.quote(File.pathSeparator));
for (String entry : split) {
if (!isEmpty(entry)) {
if (new File(entry).isDirectory() && !entry.endsWith(File.separator))... | [
"private",
"void",
"addToClassPath",
"(",
"Set",
"<",
"String",
">",
"cp",
",",
"String",
"entries",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"entries",
")",
")",
"{",
"return",
";",
"}",
"String",
"[",
"]",
"split",
"=",
"entries",
".",
"split",
"(",
... | Adds entries to the classpath.
@param cp List to which the new entries are appended.
@param entries New classpath entries (separated by File.pathSeparator). | [
"Adds",
"entries",
"to",
"the",
"classpath",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java#L217-L230 |
123,073 | apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java | AbstractCommandBuilder.loadPropertiesFile | private Properties loadPropertiesFile() throws IOException {
Properties props = new Properties();
File propsFile;
if (propertiesFile != null) {
propsFile = new File(propertiesFile);
checkArgument(propsFile.isFile(), "Invalid properties file '%s'.", propertiesFile);
} else {
propsFile =... | java | private Properties loadPropertiesFile() throws IOException {
Properties props = new Properties();
File propsFile;
if (propertiesFile != null) {
propsFile = new File(propertiesFile);
checkArgument(propsFile.isFile(), "Invalid properties file '%s'.", propertiesFile);
} else {
propsFile =... | [
"private",
"Properties",
"loadPropertiesFile",
"(",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"propsFile",
";",
"if",
"(",
"propertiesFile",
"!=",
"null",
")",
"{",
"propsFile",
"=",
"new",
"Fi... | Loads the configuration file for the application, if it exists. This is either the
user-specified properties file, or the spark-defaults.conf file under the Spark configuration
directory. | [
"Loads",
"the",
"configuration",
"file",
"for",
"the",
"application",
"if",
"it",
"exists",
".",
"This",
"is",
"either",
"the",
"user",
"-",
"specified",
"properties",
"file",
"or",
"the",
"spark",
"-",
"defaults",
".",
"conf",
"file",
"under",
"the",
"Spa... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java#L291-L311 |
123,074 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java | OrcColumnarBatchReader.initialize | @Override
public void initialize(
InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException {
FileSplit fileSplit = (FileSplit)inputSplit;
Configuration conf = taskAttemptContext.getConfiguration();
Reader reader = OrcFile.createReader(
fileSplit.getPath(),
OrcFile... | java | @Override
public void initialize(
InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException {
FileSplit fileSplit = (FileSplit)inputSplit;
Configuration conf = taskAttemptContext.getConfiguration();
Reader reader = OrcFile.createReader(
fileSplit.getPath(),
OrcFile... | [
"@",
"Override",
"public",
"void",
"initialize",
"(",
"InputSplit",
"inputSplit",
",",
"TaskAttemptContext",
"taskAttemptContext",
")",
"throws",
"IOException",
"{",
"FileSplit",
"fileSplit",
"=",
"(",
"FileSplit",
")",
"inputSplit",
";",
"Configuration",
"conf",
"=... | Initialize ORC file reader and batch record reader.
Please note that `initBatch` is needed to be called after this. | [
"Initialize",
"ORC",
"file",
"reader",
"and",
"batch",
"record",
"reader",
".",
"Please",
"note",
"that",
"initBatch",
"is",
"needed",
"to",
"be",
"called",
"after",
"this",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java#L118-L131 |
123,075 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java | OrcColumnarBatchReader.initBatch | public void initBatch(
TypeDescription orcSchema,
StructField[] requiredFields,
int[] requestedDataColIds,
int[] requestedPartitionColIds,
InternalRow partitionValues) {
wrap = new VectorizedRowBatchWrap(orcSchema.createRowBatch(capacity));
assert(!wrap.batch().selectedInUse); // `... | java | public void initBatch(
TypeDescription orcSchema,
StructField[] requiredFields,
int[] requestedDataColIds,
int[] requestedPartitionColIds,
InternalRow partitionValues) {
wrap = new VectorizedRowBatchWrap(orcSchema.createRowBatch(capacity));
assert(!wrap.batch().selectedInUse); // `... | [
"public",
"void",
"initBatch",
"(",
"TypeDescription",
"orcSchema",
",",
"StructField",
"[",
"]",
"requiredFields",
",",
"int",
"[",
"]",
"requestedDataColIds",
",",
"int",
"[",
"]",
"requestedPartitionColIds",
",",
"InternalRow",
"partitionValues",
")",
"{",
"wra... | Initialize columnar batch by setting required schema and partition information.
With this information, this creates ColumnarBatch with the full schema.
@param orcSchema Schema from ORC file reader.
@param requiredFields All the fields that are required to return, including partition fields.
@param requestedDataColIds ... | [
"Initialize",
"columnar",
"batch",
"by",
"setting",
"required",
"schema",
"and",
"partition",
"information",
".",
"With",
"this",
"information",
"this",
"creates",
"ColumnarBatch",
"with",
"the",
"full",
"schema",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java#L143-L189 |
123,076 | apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java | OrcColumnarBatchReader.nextBatch | private boolean nextBatch() throws IOException {
recordReader.nextBatch(wrap.batch());
int batchSize = wrap.batch().size;
if (batchSize == 0) {
return false;
}
columnarBatch.setNumRows(batchSize);
for (int i = 0; i < requiredFields.length; i++) {
if (requestedDataColIds[i] != -1) {
... | java | private boolean nextBatch() throws IOException {
recordReader.nextBatch(wrap.batch());
int batchSize = wrap.batch().size;
if (batchSize == 0) {
return false;
}
columnarBatch.setNumRows(batchSize);
for (int i = 0; i < requiredFields.length; i++) {
if (requestedDataColIds[i] != -1) {
... | [
"private",
"boolean",
"nextBatch",
"(",
")",
"throws",
"IOException",
"{",
"recordReader",
".",
"nextBatch",
"(",
"wrap",
".",
"batch",
"(",
")",
")",
";",
"int",
"batchSize",
"=",
"wrap",
".",
"batch",
"(",
")",
".",
"size",
";",
"if",
"(",
"batchSize... | Return true if there exists more data in the next batch. If exists, prepare the next batch
by copying from ORC VectorizedRowBatch columns to Spark ColumnarBatch columns. | [
"Return",
"true",
"if",
"there",
"exists",
"more",
"data",
"in",
"the",
"next",
"batch",
".",
"If",
"exists",
"prepare",
"the",
"next",
"batch",
"by",
"copying",
"from",
"ORC",
"VectorizedRowBatch",
"columns",
"to",
"Spark",
"ColumnarBatch",
"columns",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java#L195-L209 |
123,077 | apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java | CalendarInterval.parseSecondNano | public static long parseSecondNano(String secondNano) throws IllegalArgumentException {
String[] parts = secondNano.split("\\.");
if (parts.length == 1) {
return toLongWithRange("second", parts[0], Long.MIN_VALUE / MICROS_PER_SECOND,
Long.MAX_VALUE / MICROS_PER_SECOND) * MICROS_PER_SECOND;
} ... | java | public static long parseSecondNano(String secondNano) throws IllegalArgumentException {
String[] parts = secondNano.split("\\.");
if (parts.length == 1) {
return toLongWithRange("second", parts[0], Long.MIN_VALUE / MICROS_PER_SECOND,
Long.MAX_VALUE / MICROS_PER_SECOND) * MICROS_PER_SECOND;
} ... | [
"public",
"static",
"long",
"parseSecondNano",
"(",
"String",
"secondNano",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"[",
"]",
"parts",
"=",
"secondNano",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"==",
"1"... | Parse second_nano string in ss.nnnnnnnnn format to microseconds | [
"Parse",
"second_nano",
"string",
"in",
"ss",
".",
"nnnnnnnnn",
"format",
"to",
"microseconds"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java#L238-L254 |
123,078 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/crypto/TransportCipher.java | TransportCipher.addToChannel | public void addToChannel(Channel ch) throws IOException {
ch.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(this))
.addFirst(DECRYPTION_HANDLER_NAME, new DecryptionHandler(this));
} | java | public void addToChannel(Channel ch) throws IOException {
ch.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(this))
.addFirst(DECRYPTION_HANDLER_NAME, new DecryptionHandler(this));
} | [
"public",
"void",
"addToChannel",
"(",
"Channel",
"ch",
")",
"throws",
"IOException",
"{",
"ch",
".",
"pipeline",
"(",
")",
".",
"addFirst",
"(",
"ENCRYPTION_HANDLER_NAME",
",",
"new",
"EncryptionHandler",
"(",
"this",
")",
")",
".",
"addFirst",
"(",
"DECRYP... | Add handlers to channel.
@param ch the channel for adding handlers
@throws IOException | [
"Add",
"handlers",
"to",
"channel",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/TransportCipher.java#L103-L107 |
123,079 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java | TransportClientFactory.close | @Override
public void close() {
// Go through all clients and close them if they are active.
for (ClientPool clientPool : connectionPool.values()) {
for (int i = 0; i < clientPool.clients.length; i++) {
TransportClient client = clientPool.clients[i];
if (client != null) {
clien... | java | @Override
public void close() {
// Go through all clients and close them if they are active.
for (ClientPool clientPool : connectionPool.values()) {
for (int i = 0; i < clientPool.clients.length; i++) {
TransportClient client = clientPool.clients[i];
if (client != null) {
clien... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"// Go through all clients and close them if they are active.",
"for",
"(",
"ClientPool",
"clientPool",
":",
"connectionPool",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Close all connections in the connection pool, and shutdown the worker thread pool. | [
"Close",
"all",
"connections",
"in",
"the",
"connection",
"pool",
"and",
"shutdown",
"the",
"worker",
"thread",
"pool",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java#L279-L297 |
123,080 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/ByteArrayWritableChannel.java | ByteArrayWritableChannel.write | @Override
public int write(ByteBuffer src) {
int toTransfer = Math.min(src.remaining(), data.length - offset);
src.get(data, offset, toTransfer);
offset += toTransfer;
return toTransfer;
} | java | @Override
public int write(ByteBuffer src) {
int toTransfer = Math.min(src.remaining(), data.length - offset);
src.get(data, offset, toTransfer);
offset += toTransfer;
return toTransfer;
} | [
"@",
"Override",
"public",
"int",
"write",
"(",
"ByteBuffer",
"src",
")",
"{",
"int",
"toTransfer",
"=",
"Math",
".",
"min",
"(",
"src",
".",
"remaining",
"(",
")",
",",
"data",
".",
"length",
"-",
"offset",
")",
";",
"src",
".",
"get",
"(",
"data"... | Reads from the given buffer into the internal byte array. | [
"Reads",
"from",
"the",
"given",
"buffer",
"into",
"the",
"internal",
"byte",
"array",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/ByteArrayWritableChannel.java#L51-L57 |
123,081 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java | HiveSessionImpl.setConf | private static void setConf(String varname, String key, String varvalue, boolean register)
throws IllegalArgumentException {
HiveConf conf = SessionState.get().getConf();
String value = new VariableSubstitution().substitute(conf, varvalue);
if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)... | java | private static void setConf(String varname, String key, String varvalue, boolean register)
throws IllegalArgumentException {
HiveConf conf = SessionState.get().getConf();
String value = new VariableSubstitution().substitute(conf, varvalue);
if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)... | [
"private",
"static",
"void",
"setConf",
"(",
"String",
"varname",
",",
"String",
"key",
",",
"String",
"varvalue",
",",
"boolean",
"register",
")",
"throws",
"IllegalArgumentException",
"{",
"HiveConf",
"conf",
"=",
"SessionState",
".",
"get",
"(",
")",
".",
... | returns non-null string for validation fail | [
"returns",
"non",
"-",
"null",
"string",
"for",
"validation",
"fail"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L263-L292 |
123,082 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java | HiveSessionImpl.release | protected synchronized void release(boolean userAccess) {
SessionState.detachSession();
if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) {
ThreadWithGarbageCleanup currentThread =
(ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread();
currentT... | java | protected synchronized void release(boolean userAccess) {
SessionState.detachSession();
if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) {
ThreadWithGarbageCleanup currentThread =
(ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread();
currentT... | [
"protected",
"synchronized",
"void",
"release",
"(",
"boolean",
"userAccess",
")",
"{",
"SessionState",
".",
"detachSession",
"(",
")",
";",
"if",
"(",
"ThreadWithGarbageCleanup",
".",
"currentThread",
"(",
")",
"instanceof",
"ThreadWithGarbageCleanup",
")",
"{",
... | 1. We'll remove the ThreadLocal SessionState as this thread might now serve
other requests.
2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup
when this thread is garbage collected later.
@see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize() | [
"1",
".",
"We",
"ll",
"remove",
"the",
"ThreadLocal",
"SessionState",
"as",
"this",
"thread",
"might",
"now",
"serve",
"other",
"requests",
".",
"2",
".",
"We",
"ll",
"cache",
"the",
"ThreadLocal",
"RawStore",
"object",
"for",
"this",
"background",
"thread",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L372-L387 |
123,083 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java | HiveSessionImpl.getUserFromToken | private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
return authFactory.getUserFromToken(tokenStr);
} | java | private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
return authFactory.getUserFromToken(tokenStr);
} | [
"private",
"String",
"getUserFromToken",
"(",
"HiveAuthFactory",
"authFactory",
",",
"String",
"tokenStr",
")",
"throws",
"HiveSQLException",
"{",
"return",
"authFactory",
".",
"getUserFromToken",
"(",
"tokenStr",
")",
";",
"}"
] | extract the real user from the given token string | [
"extract",
"the",
"real",
"user",
"from",
"the",
"given",
"token",
"string"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L831-L833 |
123,084 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.setSessionUGI | public void setSessionUGI(String owner) throws HiveSQLException {
if (owner == null) {
throw new HiveSQLException("No username provided for impersonation");
}
if (UserGroupInformation.isSecurityEnabled()) {
try {
sessionUgi = UserGroupInformation.createProxyUser(
owner, UserG... | java | public void setSessionUGI(String owner) throws HiveSQLException {
if (owner == null) {
throw new HiveSQLException("No username provided for impersonation");
}
if (UserGroupInformation.isSecurityEnabled()) {
try {
sessionUgi = UserGroupInformation.createProxyUser(
owner, UserG... | [
"public",
"void",
"setSessionUGI",
"(",
"String",
"owner",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"No username provided for impersonation\"",
")",
";",
"}",
"if",
"(",
"UserG... | setup appropriate UGI for the session | [
"setup",
"appropriate",
"UGI",
"for",
"the",
"session"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L65-L79 |
123,085 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.close | @Override
public void close() throws HiveSQLException {
try {
acquire(true);
cancelDelegationToken();
} finally {
try {
super.close();
} finally {
try {
FileSystem.closeAllForUGI(sessionUgi);
} catch (IOException ioe) {
throw new HiveSQLExcep... | java | @Override
public void close() throws HiveSQLException {
try {
acquire(true);
cancelDelegationToken();
} finally {
try {
super.close();
} finally {
try {
FileSystem.closeAllForUGI(sessionUgi);
} catch (IOException ioe) {
throw new HiveSQLExcep... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"acquire",
"(",
"true",
")",
";",
"cancelDelegationToken",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"super",
".",
"close",
"(",
")",
";",
"}",
... | Close the file systems for the session and remove it from the FileSystem cache.
Cancel the session's delegation token and close the metastore connection | [
"Close",
"the",
"file",
"systems",
"for",
"the",
"session",
"and",
"remove",
"it",
"from",
"the",
"FileSystem",
"cache",
".",
"Cancel",
"the",
"session",
"s",
"delegation",
"token",
"and",
"close",
"the",
"metastore",
"connection"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L102-L119 |
123,086 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.setDelegationToken | private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN... | java | private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN... | [
"private",
"void",
"setDelegationToken",
"(",
"String",
"delegationTokenStr",
")",
"throws",
"HiveSQLException",
"{",
"this",
".",
"delegationTokenStr",
"=",
"delegationTokenStr",
";",
"if",
"(",
"delegationTokenStr",
"!=",
"null",
")",
"{",
"getHiveConf",
"(",
")",... | Enable delegation token for the session
save the token string and set the token.signature in hive conf. The metastore client uses
this token.signature to determine where to use kerberos or delegation token
@throws HiveException
@throws IOException | [
"Enable",
"delegation",
"token",
"for",
"the",
"session",
"save",
"the",
"token",
"string",
"and",
"set",
"the",
"token",
".",
"signature",
"in",
"hive",
"conf",
".",
"The",
"metastore",
"client",
"uses",
"this",
"token",
".",
"signature",
"to",
"determine",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L128-L138 |
123,087 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.cancelDelegationToken | private void cancelDelegationToken() throws HiveSQLException {
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close ... | java | private void cancelDelegationToken() throws HiveSQLException {
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close ... | [
"private",
"void",
"cancelDelegationToken",
"(",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"delegationTokenStr",
"!=",
"null",
")",
"{",
"try",
"{",
"Hive",
".",
"get",
"(",
"getHiveConf",
"(",
")",
")",
".",
"cancelDelegationToken",
"(",
"delegationT... | If the session has a delegation token obtained from the metastore, then cancel it | [
"If",
"the",
"session",
"has",
"a",
"delegation",
"token",
"obtained",
"from",
"the",
"metastore",
"then",
"cancel",
"it"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L141-L151 |
123,088 | apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.releaseExecutionMemory | public void releaseExecutionMemory(long size, MemoryConsumer consumer) {
logger.debug("Task {} release {} from {}", taskAttemptId, Utils.bytesToString(size), consumer);
memoryManager.releaseExecutionMemory(size, taskAttemptId, consumer.getMode());
} | java | public void releaseExecutionMemory(long size, MemoryConsumer consumer) {
logger.debug("Task {} release {} from {}", taskAttemptId, Utils.bytesToString(size), consumer);
memoryManager.releaseExecutionMemory(size, taskAttemptId, consumer.getMode());
} | [
"public",
"void",
"releaseExecutionMemory",
"(",
"long",
"size",
",",
"MemoryConsumer",
"consumer",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Task {} release {} from {}\"",
",",
"taskAttemptId",
",",
"Utils",
".",
"bytesToString",
"(",
"size",
")",
",",
"consumer"... | Release N bytes of execution memory for a MemoryConsumer. | [
"Release",
"N",
"bytes",
"of",
"execution",
"memory",
"for",
"a",
"MemoryConsumer",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L236-L239 |
123,089 | apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.showMemoryUsage | public void showMemoryUsage() {
logger.info("Memory used in task " + taskAttemptId);
synchronized (this) {
long memoryAccountedForByConsumers = 0;
for (MemoryConsumer c: consumers) {
long totalMemUsage = c.getUsed();
memoryAccountedForByConsumers += totalMemUsage;
if (totalMe... | java | public void showMemoryUsage() {
logger.info("Memory used in task " + taskAttemptId);
synchronized (this) {
long memoryAccountedForByConsumers = 0;
for (MemoryConsumer c: consumers) {
long totalMemUsage = c.getUsed();
memoryAccountedForByConsumers += totalMemUsage;
if (totalMe... | [
"public",
"void",
"showMemoryUsage",
"(",
")",
"{",
"logger",
".",
"info",
"(",
"\"Memory used in task \"",
"+",
"taskAttemptId",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"long",
"memoryAccountedForByConsumers",
"=",
"0",
";",
"for",
"(",
"MemoryConsumer... | Dump the memory usage of all consumers. | [
"Dump",
"the",
"memory",
"usage",
"of",
"all",
"consumers",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L244-L264 |
123,090 | apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.allocatePage | public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
assert(consumer != null);
assert(consumer.getMode() == tungstenMemoryMode);
if (size > MAXIMUM_PAGE_SIZE_BYTES) {
throw new TooLargePageException(size);
}
long acquired = acquireExecutionMemory(size, consumer);
if (acqu... | java | public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
assert(consumer != null);
assert(consumer.getMode() == tungstenMemoryMode);
if (size > MAXIMUM_PAGE_SIZE_BYTES) {
throw new TooLargePageException(size);
}
long acquired = acquireExecutionMemory(size, consumer);
if (acqu... | [
"public",
"MemoryBlock",
"allocatePage",
"(",
"long",
"size",
",",
"MemoryConsumer",
"consumer",
")",
"{",
"assert",
"(",
"consumer",
"!=",
"null",
")",
";",
"assert",
"(",
"consumer",
".",
"getMode",
"(",
")",
"==",
"tungstenMemoryMode",
")",
";",
"if",
"... | Allocate a block of memory that will be tracked in the MemoryManager's page table; this is
intended for allocating large blocks of Tungsten memory that will be shared between operators.
Returns `null` if there was not enough memory to allocate the page. May return a page that
contains fewer bytes than requested, so ca... | [
"Allocate",
"a",
"block",
"of",
"memory",
"that",
"will",
"be",
"tracked",
"in",
"the",
"MemoryManager",
"s",
"page",
"table",
";",
"this",
"is",
"intended",
"for",
"allocating",
"large",
"blocks",
"of",
"Tungsten",
"memory",
"that",
"will",
"be",
"shared",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L282-L324 |
123,091 | apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.encodePageNumberAndOffset | public long encodePageNumberAndOffset(MemoryBlock page, long offsetInPage) {
if (tungstenMemoryMode == MemoryMode.OFF_HEAP) {
// In off-heap mode, an offset is an absolute address that may require a full 64 bits to
// encode. Due to our page size limitation, though, we can convert this into an offset th... | java | public long encodePageNumberAndOffset(MemoryBlock page, long offsetInPage) {
if (tungstenMemoryMode == MemoryMode.OFF_HEAP) {
// In off-heap mode, an offset is an absolute address that may require a full 64 bits to
// encode. Due to our page size limitation, though, we can convert this into an offset th... | [
"public",
"long",
"encodePageNumberAndOffset",
"(",
"MemoryBlock",
"page",
",",
"long",
"offsetInPage",
")",
"{",
"if",
"(",
"tungstenMemoryMode",
"==",
"MemoryMode",
".",
"OFF_HEAP",
")",
"{",
"// In off-heap mode, an offset is an absolute address that may require a full 64 ... | Given a memory page and offset within that page, encode this address into a 64-bit long.
This address will remain valid as long as the corresponding page has not been freed.
@param page a data page allocated by {@link TaskMemoryManager#allocatePage}/
@param offsetInPage an offset in this page which incorporates the ba... | [
"Given",
"a",
"memory",
"page",
"and",
"offset",
"within",
"that",
"page",
"encode",
"this",
"address",
"into",
"a",
"64",
"-",
"bit",
"long",
".",
"This",
"address",
"will",
"remain",
"valid",
"as",
"long",
"as",
"the",
"corresponding",
"page",
"has",
"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L363-L371 |
123,092 | apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.cleanUpAllAllocatedMemory | public long cleanUpAllAllocatedMemory() {
synchronized (this) {
for (MemoryConsumer c: consumers) {
if (c != null && c.getUsed() > 0) {
// In case of failed task, it's normal to see leaked memory
logger.debug("unreleased " + Utils.bytesToString(c.getUsed()) + " memory from " + c);
... | java | public long cleanUpAllAllocatedMemory() {
synchronized (this) {
for (MemoryConsumer c: consumers) {
if (c != null && c.getUsed() > 0) {
// In case of failed task, it's normal to see leaked memory
logger.debug("unreleased " + Utils.bytesToString(c.getUsed()) + " memory from " + c);
... | [
"public",
"long",
"cleanUpAllAllocatedMemory",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"MemoryConsumer",
"c",
":",
"consumers",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
"&&",
"c",
".",
"getUsed",
"(",
")",
">",
"0",
")",
"{",... | Clean up all allocated memory and pages. Returns the number of bytes freed. A non-zero return
value can be used to detect memory leaks. | [
"Clean",
"up",
"all",
"allocated",
"memory",
"and",
"pages",
".",
"Returns",
"the",
"number",
"of",
"bytes",
"freed",
".",
"A",
"non",
"-",
"zero",
"return",
"value",
"can",
"be",
"used",
"to",
"detect",
"memory",
"leaks",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L428-L452 |
123,093 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java | SparkSaslServer.response | public synchronized byte[] response(byte[] token) {
try {
return saslServer != null ? saslServer.evaluateResponse(token) : new byte[0];
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} | java | public synchronized byte[] response(byte[] token) {
try {
return saslServer != null ? saslServer.evaluateResponse(token) : new byte[0];
} catch (SaslException e) {
throw Throwables.propagate(e);
}
} | [
"public",
"synchronized",
"byte",
"[",
"]",
"response",
"(",
"byte",
"[",
"]",
"token",
")",
"{",
"try",
"{",
"return",
"saslServer",
"!=",
"null",
"?",
"saslServer",
".",
"evaluateResponse",
"(",
"token",
")",
":",
"new",
"byte",
"[",
"0",
"]",
";",
... | Used to respond to server SASL tokens.
@param token Server's SASL token
@return response to send back to the server. | [
"Used",
"to",
"respond",
"to",
"server",
"SASL",
"tokens",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java#L117-L123 |
123,094 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java | SparkSaslServer.dispose | @Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
} | java | @Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"saslServer",
"!=",
"null",
")",
"{",
"try",
"{",
"saslServer",
".",
"dispose",
"(",
")",
";",
"}",
"catch",
"(",
"SaslException",
"e",
")",
"{",
"// ignore",
"}",
... | Disposes of any system resources or security-sensitive information the
SaslServer might be using. | [
"Disposes",
"of",
"any",
"system",
"resources",
"or",
"security",
"-",
"sensitive",
"information",
"the",
"SaslServer",
"might",
"be",
"using",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java#L129-L140 |
123,095 | apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java | SparkSaslServer.getBase64EncodedString | private static String getBase64EncodedString(String str) {
ByteBuf byteBuf = null;
ByteBuf encodedByteBuf = null;
try {
byteBuf = Unpooled.wrappedBuffer(str.getBytes(StandardCharsets.UTF_8));
encodedByteBuf = Base64.encode(byteBuf);
return encodedByteBuf.toString(StandardCharsets.UTF_8);
... | java | private static String getBase64EncodedString(String str) {
ByteBuf byteBuf = null;
ByteBuf encodedByteBuf = null;
try {
byteBuf = Unpooled.wrappedBuffer(str.getBytes(StandardCharsets.UTF_8));
encodedByteBuf = Base64.encode(byteBuf);
return encodedByteBuf.toString(StandardCharsets.UTF_8);
... | [
"private",
"static",
"String",
"getBase64EncodedString",
"(",
"String",
"str",
")",
"{",
"ByteBuf",
"byteBuf",
"=",
"null",
";",
"ByteBuf",
"encodedByteBuf",
"=",
"null",
";",
"try",
"{",
"byteBuf",
"=",
"Unpooled",
".",
"wrappedBuffer",
"(",
"str",
".",
"ge... | Return a Base64-encoded string. | [
"Return",
"a",
"Base64",
"-",
"encoded",
"string",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java#L200-L216 |
123,096 | apache/spark | core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java | PackedRecordPointer.packPointer | public static long packPointer(long recordPointer, int partitionId) {
assert (partitionId <= MAXIMUM_PARTITION_ID);
// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.
// Also note that this relies on some internals of how TaskMemoryManager encodes its addresses.
fina... | java | public static long packPointer(long recordPointer, int partitionId) {
assert (partitionId <= MAXIMUM_PARTITION_ID);
// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.
// Also note that this relies on some internals of how TaskMemoryManager encodes its addresses.
fina... | [
"public",
"static",
"long",
"packPointer",
"(",
"long",
"recordPointer",
",",
"int",
"partitionId",
")",
"{",
"assert",
"(",
"partitionId",
"<=",
"MAXIMUM_PARTITION_ID",
")",
";",
"// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.",
"// A... | Pack a record address and partition id into a single word.
@param recordPointer a record pointer encoded by TaskMemoryManager.
@param partitionId a shuffle partition id (maximum value of 2^24).
@return a packed pointer that can be decoded using the {@link PackedRecordPointer} class. | [
"Pack",
"a",
"record",
"address",
"and",
"partition",
"id",
"into",
"a",
"single",
"word",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java#L77-L84 |
123,097 | apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractAppHandle.java | AbstractAppHandle.dispose | synchronized void dispose() {
if (!isDisposed()) {
// First wait for all data from the connection to be read. Then unregister the handle.
// Otherwise, unregistering might cause the server to be stopped and all child connections
// to be closed.
if (connection != null) {
try {
... | java | synchronized void dispose() {
if (!isDisposed()) {
// First wait for all data from the connection to be read. Then unregister the handle.
// Otherwise, unregistering might cause the server to be stopped and all child connections
// to be closed.
if (connection != null) {
try {
... | [
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"!",
"isDisposed",
"(",
")",
")",
"{",
"// First wait for all data from the connection to be read. Then unregister the handle.",
"// Otherwise, unregistering might cause the server to be stopped and all child connections",
... | Mark the handle as disposed, and set it as LOST in case the current state is not final.
This method should be called only when there's a reasonable expectation that the communication
with the child application is not needed anymore, either because the code managing the handle
has said so, or because the child applicat... | [
"Mark",
"the",
"handle",
"as",
"disposed",
"and",
"set",
"it",
"as",
"LOST",
"in",
"case",
"the",
"current",
"state",
"is",
"not",
"final",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractAppHandle.java#L103-L121 |
123,098 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.getDelegationTokenFromMetaStore | public synchronized String getDelegationTokenFromMetaStore(String owner)
throws HiveSQLException, UnsupportedOperationException, LoginException, IOException {
if (!hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL) ||
!hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS)) {
... | java | public synchronized String getDelegationTokenFromMetaStore(String owner)
throws HiveSQLException, UnsupportedOperationException, LoginException, IOException {
if (!hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL) ||
!hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS)) {
... | [
"public",
"synchronized",
"String",
"getDelegationTokenFromMetaStore",
"(",
"String",
"owner",
")",
"throws",
"HiveSQLException",
",",
"UnsupportedOperationException",
",",
"LoginException",
",",
"IOException",
"{",
"if",
"(",
"!",
"hiveConf",
".",
"getBoolVar",
"(",
... | obtain delegation token for the give user from metastore | [
"obtain",
"delegation",
"token",
"for",
"the",
"give",
"user",
"from",
"metastore"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L461-L479 |
123,099 | apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TypeDescriptor.java | TypeDescriptor.getDecimalDigits | public Integer getDecimalDigits() {
switch (this.type) {
case BOOLEAN_TYPE:
case TINYINT_TYPE:
case SMALLINT_TYPE:
case INT_TYPE:
case BIGINT_TYPE:
return 0;
case FLOAT_TYPE:
return 7;
case DOUBLE_TYPE:
return 15;
case DECIMAL_TYPE:
return typeQualifiers.getSc... | java | public Integer getDecimalDigits() {
switch (this.type) {
case BOOLEAN_TYPE:
case TINYINT_TYPE:
case SMALLINT_TYPE:
case INT_TYPE:
case BIGINT_TYPE:
return 0;
case FLOAT_TYPE:
return 7;
case DOUBLE_TYPE:
return 15;
case DECIMAL_TYPE:
return typeQualifiers.getSc... | [
"public",
"Integer",
"getDecimalDigits",
"(",
")",
"{",
"switch",
"(",
"this",
".",
"type",
")",
"{",
"case",
"BOOLEAN_TYPE",
":",
"case",
"TINYINT_TYPE",
":",
"case",
"SMALLINT_TYPE",
":",
"case",
"INT_TYPE",
":",
"case",
"BIGINT_TYPE",
":",
"return",
"0",
... | The number of fractional digits for this type.
Null is returned for data types where this is not applicable. | [
"The",
"number",
"of",
"fractional",
"digits",
"for",
"this",
"type",
".",
"Null",
"is",
"returned",
"for",
"data",
"types",
"where",
"this",
"is",
"not",
"applicable",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TypeDescriptor.java#L139-L158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.